Recently, after swapping a couple of machines (I sent my first-generation Intel-based Mac mini back to the Macworld offices, and we bought an iMac for the kids and general use), I realized that I had inadvertently also disabled my locally-hosted Web sites: I used to use the mini as a local Web server, and it served out copies of the
Mac OS X Hints site, as well as the various family sites I maintain. I didn’t really want to keep the iMac running all the time just to have the Web server running, so I decided to move the server to my Mac Pro.
While OS X ships with a built-in Web server, it doesn’t ship with
MySQL, the database engine that enables sites such as macosxhints.com to work. Installing it is relatively straightforward—there are OS X installer versions available on the MySQL site. About the only trick comes in choosing which version of MySQL to install—some content management systems only work with certain versions. In my case, I wanted MySQL 4.1 for compatibility with the macosxhints.com site. Unfortunately, I managed to download and install version 5.0 without noticing. As soon as I noticed the problem, I downloaded the 4.1 package, and attempted to install it. The installer, however, refused to proceed, telling me there was already a newer version of MySQL installed.
Since the installer didn’t want to install due to the presence of the newer version of MySQL, I thought I’d first get rid of that newer version. In the case of MySQL, all the code lives in the /usr/local/mysql directory, which is actually a symbolic link (like an alias in the Finder) to a directory with a much longer name. So in Terminal, I issued a
sudo rm -r /usr/local/mysql-long-directory-name to remove all the MySQL code. Note that this command will delete all of your MySQL databases in addition to MySQL itself! In my case, I didn’t care, because I hadn’t yet migrated the databases over to the Mac Pro.
I then tried to run the installer again, but it still failed, saying a newer version was installed. After some thinking, I remembered the /Library/Receipts folder—this is where installers write out records of what they did. Perhaps, I thought, the MySQL installer is looking at the Receipts folder, seeing the MySQL 5.0 receipt, and using that as the basis for stopping the install.
In Terminal, I did
cd /Library/Receipts, and then
ls -d mysql* to see what was there. Sure enough, I found a receipt for the MySQL 5 installation, named something like
mysql-standard-5.0.67-apple-darwin8.5.1-i686.pkg. I deleted that directory (
sudo rm -r mysql-standard...), and then ran the 4.1 installer again. Success! The 4.1 install ran fine, I then moved over my databases, and had the internal web server up and running again a few minutes later. OK, so it was several hours later; it just seemed like a few minutes!
Generalizing from my experiences with MySQL, here’s the process I would follow to downgrade a program that was installed with Apple’s installer:
- Run the installer for the new version again. If you’re lucky, they’ll be an uninstall option. If so, use that, then install the old version. Also look for an uninstaller hiding in the application’s folder, if it has one.
If there’s no uninstaller, remove all traces of the new program from your machine. Start by looking at the program’s receipts folder in /Library/Receipts in Terminal. You should see a top-level receipts folder, which you can
From there, use
cd until you find a file whose name ends in
.bom. This file will usually (but not always) reside in the Contents folder and be named
Archive.bom. Once you’ve found the file, type
lsbom Archive.bom | more and press Return. This will show you exactly which files the installer wrote to your system.
In most cases, it will also show you the full path to those files. Use this data to delete all traces of the newer program from your system. In the case of MySQL, unfortunately, this file isn’t much help, as it doesn’t show the final install path. If that’s the case for your program, too, you’ll have to resort to searching your system (or Google searching for help) to find and eliminate all the parts.
- After removing all the program’s parts, remove the actual receipts folder from the /Library/Receipts folder. You’ll need to use
sudo rm -r receipts_folder_name, as changes to this directory require admin authorization.
- Once you’ve removed all the parts and the receipts file, run the installer for the older version of the program, and it should work just fine.
Of course, there’s a big bold caution that goes with these instructions: when you’re messing around with removing installed versions of programs, you can damage things—you could inadvertently remove a system-owned file, for instance, or miss a piece of the code that then messes up your downgrade. Proceed at your own risk.
Perhaps at some point in the future, OS X will have easy snapshots and restore points, as has been possible on Windows for quite a while now. Until then, though, downgrading will be something of a trial-and-error process.