Always Learning
One of the things I’ve been doing recently at work is rebuilding Apple iMacs, MacBooks etc back to their default state as if they’d just shipped from the factory. Along the way I’ve learned a few interesting things of which I’d like to share along with how I “Sysprep” each Mac. Whilst I know a quick Google Search will yield plenty of results wherein you’ll find the steps I’ll outline but heck I’d like to share my way anyway.
If you’re intending to sell a Mac that you own the first thing you’ll need to do is backup your data. It may seem logical to most but for every person who remembers there is always someone who doesn’t. While it’s true that, with some software, you can recover lost data one can never be sure that you will be able to recover what you want. Before I rebuilt my MacBook I made sure to copy my data to my NAS and while some of it will stay there (nothing like a good bit ‘o spring cleaning) it is good to know I can access it no matter what. The other thing worth doing, especially if you’ve bought music/movies etc from the iTunes store is to de-authorise that machine. Apple only allows for five authorised machines and while whoever acquires your Mac after you won’t be able to download your music and play your music (least not without your account details) freeing up that activation is always useful. This is done by opening iTunes, clicking ‘Store’ and then the option ‘Deauthorize this computer’. You’ll be asked to input your iTunes account details but once that’s done you’ll receive a message telling you the task is complete.
The next step is to completely wipe your Mac of information and this can be done in two ways. If you’re running a Mac on OSX 10.7+ (Lion or Mountain Lion) your Mac now sports a recovery partition allowing you to reinstall OSX or recover from Time Machine without physical media as since Mountain Lion Apple have gone down the digital distribution route only. Otherwise you’ll need your original disks supplied with your Mac when you purchased it, if you’re using this method hold down ‘C’ when the machine restarts to boot using your Superdrive or ‘Command-R’ if you’re on Lion or above. Once in you’ll want to select ‘Disk Utility’ which will allow you to wipe your Mac clean. Click on the ‘Erase’ tab at the top and make sure you select your Mac’s HDD on the left. Next you’ll want to select ‘Mac OS Extended (Journaled)’ as your volume format and give the drive a name; I tend to use the generic ‘Macintosh HD’. Now, if you want to, you can just go ahead and click ‘Erase’ and off it’ll go and wipe the drive. However I’m more than a little paranoid about this stuff so I would recommend clicking ‘Security Options’ first and selecting whichever option you like though at the very least selecting the option that will zero the disk. Obviously the further up the sliding scale you go the longer it’ll take to format the drive but in my humble opinion that’s time worth spending to make sure any data you had on there will be a bugger to recover.
So you’ve now waited ‘x’ amount of time for your Mac to erase and format your drive and you’re now ready to install OSX which is pretty straight forward, just let it run. Once OSX is installed you’ll need to create a dummy account so you can install the software of fthe ‘Applications Install’ disk your Mac will have come with originally or any extra software you want to sell your Mac with. I generally just use ‘test’ and if the OSX version is Lion and up just use a simple password for authentication (for anything below Lion I don’t bother with a password as we’ll delete this user later). Crack on and install the software, run updates etc to make sure it’s as up-to-date as it can be. Once there’s nothing else to update or install it’s time to ‘Sysprep’ your Mac for sale so that the new user will be treated to Apple’s first run experience which got rather boring after Snow Leopard. Anyway here’s the process (note: you can do some very powerful things from the command line and you can very easily break your nice fresh install so make sure you type things in correctly!):
- Once you see the Apple boot screen, the slightly beige coloured screen, hold down ‘Command+S’; this will boot the machine into single user mode
- Check the filesystem by typing: /sbin/fsck –fy
- Hopefully there’ll be no errors and you can mount the filesystem: mount –uw /
- Start the directory services: launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist (on Lion and above it’s com.apple.opendirectoryd.plist)
- Find what groups your user belongs to: dscl . –list /groups GroupMembership | grep test
- Remove from all groups: dscl . –delete /Groups/groupname GroupMembership test
- Delete the user: dscl . –delete /Users/test
- Remove the corresponding home directory: rm –R /Users/test
- Clear the first run flag: rm /var/db/.AppleSetupDone
- Then shutdown: shutdown –h now
The Mac should now shutdown. You can turn it back on to check it runs the first run sequence and once the first config screen appears hit ‘Command+q’ and it will ask if you wish to shutdown. So there you have it, your beloved Mac is now ready to be sold and you’re safe in the knowledge that it’s been securely wiped of any info, your data is backed up and the new owner will get the full Apple experience.
Now earlier in this, rather long, piece I mentioned I came across a few interesting things mostly coming about due to issues imaging machines. Firstly I learned that if your Mac requires a Superdrive firmware update it will only install when your Mac is running the original OSX version it shipped with. So while you may have upgraded over time if you want to make sure all updates are applied you may want to start with original OS first otherwise it’ll stick around unable to be installed. So before applying say the 10.6.8 update to a Snow Leopard based machine, apply all other updates first rebooting after each set to make sure you’ve applied everything before applying the combo update.
The other “fun” issue I had was when an iMac refused to boot using a CD or USB boot device. All it would do would show the Apple logo on a grey screen and that’s it. If you come up against this foe but have a spare Mac hanging around you can still wipe and re-install OSX; it’s just a bit fiddly. On your donor Mac boot it in to target disk mode by holding down ‘T’ at boot time. You’ll get a grey screen with a Firewire and/or Lightening logo. Connect this Mac to your misbehaving machine and boot that one whilst holding down ‘Alt/Option’. This will present you with a boot menu and you should see your other Mac’s HDD as a bootable device. Place your OSX boot CD into your donor Mac and, after a bit of whirring, it should appear as a boot option. Select this and after a bit more whirring you should be presented with the familiar OSX install CD screen allowing you to proceed as normal.
So there you have it a, hopefully, straight forward way of preparing your Mac for sale or reuse and a couple of pointers if things get a little bit weird and I promise my next post won’t be as long winded!