Mac OS X: Bash Fix For “Shellshock”

posted in: Uncategorized | 0

Official Apple Updates For Bash

OS X bash Update 1.0 – OS X Mavericks
OS X bash Update 1.0 – OS X Lion
OS X bash Update 1.0 – OS X Mountain Lion

Alternative to Apple Bash

Warning: proceed with caution. This is for advanced users. This will involve manipulating system files.

First, check which version of bash your Mac is running and if it is not 4.3.x then proceed:

Normal Installation

First you’ll need to install homebrew, a package manager for Mac OS X:

Update Homebrew and install bash as follows:

Once Homebrew has finished installing bash, it should be version 4.3.27 or higher.

You may need to remove and install an updated readline:

Now backup the existing version of bash and create a symbolic link to the Homebrew bash:

TIP: I recommend that if you previously installed bash through Homebrew, uninstall and remove any previous bash versions in the Cellar directory before installing the latest version. This is reduce any complications that might occur.


If you run into the following:

Then you need to open the Terminal – Preferences and use the backed up version of bash:
Terminal Preferences

Then quit Terminal and start it again.

You will need to enter the following:

Once readline is installed quit Terminal and start it again. Then change the shell path back to Default in Terminal – Preferences – Shell Opens With. Quit Terminal and start it again.

Bash Didn’t Update

Check the bash version to make sure it is 4.3.27 or higher:

If the bash version did not update:

Go back in preferences change shell path back to the backup version of bash in Terminal – Preferences – Shell Opens With as shown in Troubleshooting.
Restart Terminal.

Then you need to uninstall Homebrew bash:

Next go to cd /usr/local/Cellar/ and run rm -rf bash.

Now install bash again:

Change Terminal – Preferences – Shell Opens With once again back to Default. Restart Terminal.

Assuming you still have the symbolic links to /usr/local/bin/bash , checking bash version should return:

Further reading about bash, Homebrew, and the “shellshock” bug:


Clarified steps for troubleshooting and to install homebrew.