Linux Firefox Multiple Versions Multiple Profiles simultaneously

There are many reasons for using multiple Firefox Versions and multiple Firefox profiles at the same time. Firefox Developers , Web Developers and Security Consious People definetely need to do so. Here is an easy recipe.

First download all the firefox*.tar.bz2 versions you need. At this time ( 1337861365 ) firefox-3.6.28 and firefox-12.0 are the latest "secure" - stable versions, firefox-13.0b4 is the latest beta release and firefox-14.0a2 is the latest alpha development release.

You could get them at:
Mozilla Firefox Older Release ( currently 3.6.28 )
Mozilla Firefox Current ( currently 12.0 )
Mozilla Firefox Aurora ( currently 14.0a2 )
Mozilla Firefox Beta ( currently 13.0b4 )

Let 's create a directory structure that holds binary files , configuration files, and profile information. A directory structure that can just be copied to another Linux Workstation if needed.

$ cd ~
$ mkdir firefox
$ cd firefox
$ cp ~/Downloads/firefox-* .
$ ls
firefox-12.0.tar.bz2  firefox-13.0b4.tar.bz2  firefox-14.0a2.en-US.linux-i686.tar.bz2  firefox-3.6.28.tar.bz2
$ bzip2 -d firefox*
$ tar -xf firefox-12.0.tar
$ mv firefox firefox-12.0
$ tar -xf firefox-3.6.28.tar 
$ mv firefox firefox-3.6.28
$ tar -xf firefox-13.0b4.tar
$ mv firefox firefox-13.0b4
$ tar -xf firefox-14.0a2.en-US.linux-i686.tar
$ mv firefox firefox-14.0a2
$ rm firefox-*tar
$ mkdir firefox-profiles
We should be able to move our Firefox Environment to another Linux Workstation by moving this structure along with the ~/.mozilla directory there.

Let 's create profiles. I will use the following scheme in creating profiles:
dev-(Firefox Version)-n for development profiles
sec-(Firefox Version)-n for secure profiles ( profiles with Flash , Java , and the rest doubious plugins disabled )
features-(Firefox Version)-n for profiles using many plugins, iffie extentions , etc

Profiles can be used across different firefox versions but things break across different versions. So do it this way.

Let 's create Profiles
$ ~/firefox/firefox-12.0/firefox -no-remote -P
The Firefox Choose User Profile pops up
->Click on the "Create Profile..." button
->Click on "Next"
->Enter "dev-12.0-0" for Profile Name
->Click on "Choose Folder..." and Choose ~/firefox/firefox-profiles/dev-12.0-0
->Click on "Open"
->Click on "Finish"
->Click on the "Create Profile..." button

I stayed in the loop and created the profiles: dev-12.0-0 , sec-12-0 , features-12-0 , dev-3.6.28-0 , dev-13.0b4-0 , dev-14.0a2-0 . Each of these profiles has its own directory named with the same name as the profile in ~/firefox/firefox-profiles/.

For firefox-3.6.28 change the path set by the moz_libdir variable in the shell script that initializes the binary.
$ grep "#g0-"  ~/firefox/firefox-3.6.28/firefox
#moz_libdir=/usr/local/lib/firefox-3.6.28     #g0-off  
moz_libdir=~/firefox/firefox-3.6.28           #g0-add

We can use bash aliases and a bash function to start all these versions and profiles.

Add the following line to your .bashrc

$ tail -1 ~/.bashrc 
source ~/firefox/firefox-bash-functions-and-aliases 

And put at ~/firefox/firefox-bash-functions-and-aliases something like the following
$ cat ~/firefox/firefox-bash-functions-and-aliases
#g0 2012 - firestarter - firefox versions and profiles starter bitch

#Start the Firefox that comes with your GNU/Linux distribution , if older version  -p does not choose profile
alias firefox-distribution='firefox -no-remote &'

#Start FF 3.6.28 , -p does not choose profile , the choose profile dialogoue should come up - choose dev-3.6.28-0
alias dev-3.6.28-0='~/firefox/firefox-3.6.28/firefox -no-remote &'

#Start FF 12.0 with profile dev-12.0-0
alias dev-12.0-0='~/firefox/firefox-12.0/firefox -p dev-12.0-0 -no-remote &'
alias sec-12-0='~/firefox/firefox-12.0/firefox -p sec-12-0 -no-remote &'
alias features-12-0='~/firefox/firefox-12.0/firefox -p features-12-0 -no-remote &'

alias dev-13.0b4-0='~/firefox/firefox-13.0b4/firefox -p dev-13.0b4-0 -no-remote &' 

alias dev-14.0a2-0='~/firefox/firefox-14.0a2/firefox -p dev-14.0a2-0 -no-remote &'

#If you don't like debug messages direct them to /dev/null
#alias dev-14.0a2-0='~/firefox/firefox-14.0a2/firefox -p dev-14.0a2-0 -no-remote  2>/dev/null &'

function firefox-profiles {
echo "dev-3.6.28-0"
echo "dev-12.0-0"
echo "sec-12-0"
echo "features-12-0"
echo "dev-13.0b4-0"
echo "dev-14.0a2-0"

Let's start them all up.
$ source ~/.bashrc
$ firefox-profiles
$ firefox-distribution 
[1] 12376
->The "Choose profile" dialogue comes up , Choose default
$ dev-3.6.28-0
[2] 12406
->The "Choose profile" dialogue comes up , Choose dev-3.6.28-0
$ dev-12.0-0
[3] 12448
$ sec-12-0
[4] 12480
$ features-12-0 
[5] 12514
$ dev-13.0b4-0
[6] 12550
$ dev-14.0a2-0
[7] 12574

Hit Enter to get a cursor if debug messages pop up on your terminal. Use "2>/dev/null" at the end of each alias if you don't like seeing them.

Cool! Now I have 7 different firefox profiles and 5 different firefox versions open at the same time. Pointing them to the IPduh Anonymity Check is a fast way to confirm versions, plugins , settings etc.

Each of the firefox profiles is started as a job and you can see basic debug messages by bringing it to the foreground.

An easy way to get around Flash and Java Issues is to use these plugins on profiles made for the Firefox that comes with your distribution of GNU/Linux or the one "properly installed" --the one started by firefox-distribution.

It would be pretty easy to adjust firestarter to all kinds of versions and profile combinations. Here is a useful Firefox Command Line Options reference .
For the versions that use a script to initialize the Firefox binary ( 3.6.28 and earlier ) the script source itself is a useful reference.
Also, all binaries respond well to the -help flag. eg:
$ ~/firefox-12/firefox -h
Usage: /home/g/firefox-12/firefox [ options ... ] [URL]
       where options include:

X11 options
  --display=DISPLAY  X display to use
  --sync             Make X calls synchronous
  --g-fatal-warnings Make all warnings fatal

Firefox options
  -h or -help        Print this message.
  -v or -version     Print Firefox version.
  -P        Start with .
  -migration         Start with migration wizard.
  -ProfileManager    Start with ProfileManager.
  -no-remote         Open new instance, not a new window in running instance.
  -UILocale  Start with  resources as UI Locale.
  -safe-mode         Disables extensions and themes for this session.
  -jsconsole         Open the Error console.
  -browser           Open a browser window.
  -new-window   Open  in a new window.
  -new-tab      Open  in a new tab.
  -preferences       Open Preferences dialog.
  -search      Search  with your default search engine.
  -private           Enable private browsing mode.
  -private-toggle    Toggle private browsing mode.
  -setDefaultBrowser Set this app as the default browser.

Other useful references:
Setting Up a Development Environmnet
Setting up an extension development environment

Linux Firefox - Multiple Versions - Multiple Profiles Simultaneously