How to restore /bin/bash on Mac OS X

So your (my) /bin/bash has gone missing. You (I) overwrote it or deleted it while moving files onto the PATH. It happens to the best of us. Ahem.

Luckily, the problem isn’t as major as you might guess. But you’ll need a Mac OS X installation CD, because you need to work in the terminal to solve the problem.

Step 1: Boot from the install CD
Put the installation CD into the drive and restart the computer. Hold option when the computer restarts until you get to the boot screen. Once the CD shows up, click it and boot up.

Step 2: Copy the install CD’s bash executable into your bin
Pull down the Utilities menu at the top and get into the terminal. cd into your hard drive’s bin directory (you’ll find your hard drive in the Volumes directory). Use the following command to copy the installation CD’s bash into your bin:

Step 3: Changing permissions and users
I’m not sure if this step is necessary, but it can’t hurt. Once the file is copied (and while still in your installation’s bin directory), type the following commands to ensure bash is executable and accessible by root and superusers:

Step 4: Ta-da!
Now, restart, hold option, and boot into your regular installation. Now try to open Terminal (or iTerm or whatever), and voila! Bash away.

2 Responses to “How to restore /bin/bash on Mac OS X”

  1. Really good effort man, perfect fix and run through!!

  2. How can I cd into your hard drive’s bin directory?

Leave a Reply