Saturday, April 24, 2010

10 steps to running multiple versions of Firefox simultaneously on OS X 10.6

UPDATE: I have verified this works on OSX 10.4 and 10.5
UPDATE 2: I have verified this works with FF 4.0 as well
UPDATE 3: I have verified this works on OSX 10.7 as well as with FF 5.0+ (and the auto updating to new versions)

When I need to debug web apps in multiple versions of Firefox on a Mac, a major hurdle is not being able to concurrently run more than one version from the Applications folder. Simply adding the different versions under different names to the folder doesn't work. The main issue in doing so is the various versions will share the same profile directory which is a big no-no. The problems range from constant messages about upgrades to incompatible plugins and extensions, but most importantly, not actually being able to run them simultaneously.

So, off to the alter of the sage of search I went to figure out how to get around this. I quickly found a few ways to achieve this goal, all of which are great if they meet your individual needs. For mine, I tried both John Resig's method (of the jQuery fame) and Devon Govet's slightly more involved method. While they are essentially the same, I prefer Devon's approach since the corresponding profiles are auto loaded.

Why would you want to have the profiles auto loaded? Without autoloading, every time you launch a version of Firefox, it will prompt you to select the profile you want to use before launching the browser. Seems simple enough, but one caveat is a profile currently in use by one version cannot be used by another version (there are some other issues with sharing profiles across versions as well). So you would need to have as many profiles for as many versions that you wish to run simultaneously. For example, since I am running three versions of Firefox, I would need three profiles.

Again this seems simple enough. The main issue with selecting a profile every time a different version is launched (aside from being easily annoyed by popups) is installing add-ons like Firebug (an essential for debugging web apps). Firebug is version dependent upon the version of Firefox it is installed. When you install an add-on, Firefox installs (at least some) dependent files for the add-on in the profile directory. Essentially this means you must always use the same profile for the same version of Firefox or risk screwing it up.

Once more, seems simple enough. Name your profiles to match the versions of Firefox they are to be used with. Then when you launch a version and are prompted to select a profile, just select the corresponding profile. Up to this point, there is no significant difference between the methods suggested by John and Devon, however this is where John's approach ends and Devon continues a step further to automate the selection.

What is the advantage for John's approach? Either the profile prompt is not a big deal for you or you have a need to have multiple profiles per version of Firefox. However, if you only plan to have one profile per version, why waste the time (and add the risk of error) selecting a profile every time you launch the browser? For me this was the case, and is the main reason I prefer Devon's approach.

Now we finally get to the HOW do you do all of this.


Note 1: For most of the steps, you could do them from either a Finder window or from a Terminal screen. One particular step will require you to use Terminal to enter some commands. Therefore I will only include Terminal instructions since you will need to repeat some steps to get to the point where you would need to execute the commands if you used Finder.
Note 2: This tutorial assumes a fresh install of all versions of Firefox. If you are using an existing installation of one version of Firefox, ignore step two for the existing version installed only. Also, you can not simply rename the default profile as on of the version specific profiles. The underlying profile directory associated with the default profile will still be default and therefore initially be used automatically by all other versions when first loaded. I haven't tested this yet, but I believe you should be able to create the new version specific profile, copy the contents from the default directory to the new one and then remove the default profile in both the Profile Manager and the profiles folder.
Note 3: Proceed at your own discretion.

Say you wanted to run the latest versions of Firefox 3.0, 3.5 and 3.6. First download them from

Part 1

Setting up Firefox to run multiple versions simultaneously

1. Open a Terminal screen (if you are stumped on this step, you might want to reconsider continuing on until you have familiarized yourself with terminal commands in general)

2. Install Firefox into the Applications folder as usual (or wherever you prefer to put it but I will use the Applications folder as the installed directory)

3. Go to the Applications folder within Terminal
$ cd /Applications
4. Rename Firefox to Firefox3.0 (or whatever you prefer)
$ mv
5. IMPORTANT: Launch the renamed Firefox from the Applications folder and then quit once it is fully loaded

6. Go to the Firefox application contents folder in Terminal
$ cd
7. Add the profile for this version (save time and add them all now)
$ ./firefox-bin -Profilemanager
This command should launch the following dialog box:
- Click "Create Profile" and name your profile something unique per version (for example "Firefox3.0")
- Once you have added your profiles, click "Exit"

Part 2 (optional)

Setting up Firefox to auto select the correct profile on launch

8. Copy the existing firefox-bin to a new file (for example "firefox-bin_3_0")
$ cp firefox-bin firefox-bin_3_0
9. Edit firefox-bin to select the profile that was created for this version ("Firefox3.0")
$ echo -e '#!/bin/bash\n/Applications/ -P Firefox3.0 &' > firefox-bin
10. You're done! Now launch Firefox3.0 from the Applications folder and save to dock if you wish.

Repeat these steps for each version (3.5 and 3.6 in this example) noting to change the names to something corresponding to the version you want to install in the appropriate steps.


No comments:

Post a Comment