What to Do When Your Mac OS X Gets Weird

First, don't panic - almost everything you need to do can be done without resorting to the command line. Second, Macs are almost fool proof. They have a built in recovery image on a partition on the hard drive, can boot from any media, and finally, can install directly from the servers at Apple if no boot drive is found. If Apple is in the hardware business, why is there software so good?

Background...

I had been adding an extension to PHP on one of the the Mac Mini's, and started treating it like a Linux box. It isn't. By the time the extension was done and installed, weird things had started happening. Programs would hang for 10 seconds while idle, as other programs continued to function. Some programs would say they loaded, but I couldn't find them anywhere. I had installed some kernel drivers - perhaps I needed to take a step back. I read up on putting a new copy of OS X on before attempting it. It appeared to be a pretty straightforward task. Powering off the Mac went Ok. It went down the rabbit hole at step two - "Hold CMD-R while powering on the Mac". I spent four hours trying to get something other than an error screen on boot after that.

It turns out that in order to recover, you have to have a single display. Nowhere did I find anything even hinting at that. If you have two displays, the recovery process won't run. Not from anywhere. And it gets worse. If you download the OS X Installer from the App Store, and you click "Next", you won't be able to boot from your hard drive, either. I first tried the "normal" recovery partition. I tried, in order, the recovery partition, a USB thumb drive, an external USB hard drive, Time Machine, and an SD card. All acted the same. After completely losing control of the situation, I used the Macbook Pro to do more research. Nothing. I decided to strip it down to a mouse, keyboard and single display. As soon as I pulled the displayport connector, the recovery process started up.

Recovery - Step by Step

If you already have Time Machine, or your recovery partition is functional, you don't need to do the next part because there is a backup OS X installer on both. Skip ahead to Reinstalling OS X.

Preparing an Install Disk

The ISO image would imply to some that it will fit on a CD or DVD, but it will not fit on a single layer DVD. It is just a tiny bit too large. You need a drive with 8 GB capacity in order to get it to fit. Either a USB thumb drive, SD card (for Mini's and Macbook Pro's), or a regular external USB drive. Everything on the drive will be replaced by OS X's install image, so don't expect to keep anything else on the drive during this process.

Get an OS X Disk Image

The easiest way is to go to the App Store, click on Purchases, find OS X Mountain Lion, or whatever your latest version might be, and click on Download. It takes a while - it's 4.4 GB. When you have it - DO NOT run it. If it tries to auto-run, use the menu to quit the application. You can see it as "Install OS X Mountain Lion" by opening a Finder window and going to the Application folder. Click and hold to bring up the context menu. Select "Show Package Contents". You will see something like this:

Mac OS X ISO image in the installer app

In the Contents->SharedSupport folder is an ISO image of the DVD, named "InstallESD.dmg". Keep this Finder window open - we'll need it in a bit.

Erase the External Drive

You have to erase the external drive. The idea is to make sure it says "Partition Map Scheme : GUID Partition Table" at the bottom of the Disk Utility page when you're done. This means the drive is bootable. I can't figure out why this is important, since we are going to write an ISO image over it, but it needs to be done. Open the Disk Utility application, and plug in your external drive. It will show up on the list of drives.

Mac OS X External drive in Disk Utility

Now you need to drag "InstallESD.dmg" image from the Finder window to the lefthand column on the Disk Utility, and drop it at the bottom. You should see it show up as another drive when you let go. Click on the "InstallESD.dmg" in the Disk Utility and, if it doesn't go there automatically, click on the Restore tab. If it isn't there already, drag the external drive to the lower text field. You should see something like this:

Mac OS X ISO image in Disk Utility

Clicking the Restore button in the lower right will cause "InstallESD.dmg" to overwrite the drive shown in the lower of the two text fields. Be certain you have the right one. Something spooky. As soon as you click Restore, the target drive name disappears from the lower text field. It still works, it's just odd. When it is done with it's copying and verifying the disk, you want to shut down the computer.

Reinstalling OS X

Unplug everything except the keyboard, mouse, one display, and whatever drive you are using for the installation. Hold down the CMD-R combination while you power the machine back on and keep them held down until the Apple logo appears on the gray screen. You will be presented with the "OS X Utilities" screen.

There are four options on the OS X Utilities screen.

  1. Restore From Time Machine Backup

    If you have a Time Machine backup, and choose to use it, your machine will be restored to the state of the backup you choose.

  2. Reinstall OS X

    If you reinstall OS X, it very quickly copies some things from the install disk, then very slowly downloads and installs updates. On a 20 Mbps cable connection it takes nearly two hours. You will not lose your data, since only the operating system files will be replaced.

  3. Get Help Online

    This option loads Safari and takes you to a page that describes the options available, similar to this page.

  4. Disk Utility

    Here you can format or re-partition your disk, new or old, and erase all of your data.

If you have any trouble with these instructions, please email me from the contact page. I try to keep them up to date, but I've only used all of the options on a Mac Mini.

Quality hosting at reasonable prices.