How to create a ‘Shell Shock’ Bash Update installer for OS X 10.6

In response to the Shell Shock bug found in the Bash command line interpreter included in OS X, Apple issued several updates to tackle the issue. However, these updates are for supported versions of OS X only, meaning those who are using OS X 10.6 Snow Leopard or earlier will not receive an update.

If you are one of these people who is still using Snow Leopard, then there are a couple of approaches you can take to fix Bash on your system. First, you can download, patch, and compile your own version of Bash according to the instructions outlined here. This is my recommended approach, but it will need to be done on each system you have, and also may be daunting for some users who do not wish to install XCode and run numerous Terminal commands.

The second approach is to simply modify Apple’s Bash Updater so it will run on OS X 10.6 or earlier. To do this, you need to edit a small script in the installer package, which can be done with the following steps (only two Terminal commands are used):

  1. Download the recent Bash Update for OS X Lion
  2. Mount the .dmg file, and copy the .pkg file within it to your desktop
  3. Open the Terminal and run the following command (simply copy and paste it):
    pkgutil --expand ~/Desktop/BashUpdateLion.pkg ~/Desktop/modified
  4. Open the new folder called “modified” on your desktop, and then use TextEdit to open the file called Distribution (right-click it and choose Other from the Open With menu, and then select TextEdit from your Applications folder).
  5. Locate the functions called “InstallationCheck(prefix)” and “VolumeCheck(prefix)” in the file (they are the only items that begin with the word “function”) and edit them by replacing all the contents of the functions between the first and last braces with “return true;” so they look like the following:
    function InstallationCheck(prefix) {
         return true;
    }
    function VolumeCheck(prefix) {
         return true;
    }

    When done, the entire file’s contents should look like the following. Note that if you are not sure where to edit, then simply copy the following text and replace the entire contents of the Distribution file with it (I have highlighted the modified functions in red text):

       SU_TITLE      function InstallationCheck(prefix) {  return true; } function VolumeCheck(prefix) {  return true; }
    
    
    
    
    
    
    
          #BashUpdateLion.pkg
    
    
    
    
  6. Press Command-S to save the file, and then quit TextEdit.
  7. Return to the Terminal and run the following command (copy and paste the entire line into the Terminal):
    pkgutil --flatten ~/Desktop/modified ~/Desktop/BashUpdateModified.pkg

When you have completed this last step, you will see a new .pkg file located on your desktop called “BashUpdateModified.pkg,” and you can now open it on your OS X 10.6 system and have it install the patched version of Bash that Apple included in this updater. You can then copy this installer to another Snow Leopard system and run it there, if needed.

Keep in mind that even though this Bash version should work just fine for practically all uses, it was neither built nor tested specifically on versions of OS X prior to Lion, so there is a possibility that some functions may not work properly. This is just a precaution to be aware of, since most if not all built-in OS X functions should work just fine with this version of Bash.

As always, before doing any modification to your system, be sure you make a full backup of your Mac using Time Machine or a system cloning tool, and then ensure all services, programs, and other features of your Mac are running as expected (most should be just fine).

Thanks to MacIssues reader James Trim for writing in with instructions about this approach.

Author

Mac Issues

At Mac Issues, we're dedicated to helping you learn how to use your Macbook properly. With tutorials, how-to troubleshooting guides & real reviews, hopefully we can make your day that little bit easier.

Read more from Mac Issues