Opening Multiple Instances of Firefox


Previously, I wrote how to open multiple instances of Safari and Firefox (here). However, the procedure won’t work for the newer versions of Firefox. So, we need a workaround.

Here is the solution. Save the following script to the location of your choice.


#!/bin/bash
export ProfDIR="/Users/$USER/Library/App*/Firefox"
export BINDIR="/Applications/Firefox.app/Contents/MacOS"
#Creating a Randomly named profile
RandomNumber=$RANDOM
$BINDIR/firefox-bin -CreateProfile $RandomNumber
#Copying the default profile over
cp -R $ProfDIR/Profiles/*.default/* $ProfDIR/Profiles/*.$RandomNumber/
# Running the new instance of the Firefox
$BINDIR/firefox-bin -p $RandomNumber
#Removing the created Profile
rm -rf $ProfDIR/Profiles/*.$RandomNumber
#Removing the profile name
head -n 7 $ProfDIR/profiles.ini > tmp
cat tmp > $ProfDIR/profiles.ini
rm -rf tmp

Make sure that you give the executing permission to the script with chmod command. Then, if you call the script above, it will create a new instances of FireFox for you.let’s say we have stored the script in ~/myscripts/firefox. Then all you need to do is to type:

~/myscripts/firefox &

Remember, this assumes the default profile is the only profile present and you are going to start the Firefox with the default profile. So, if you have multiple profile already created then make sure you adjust the code in “Removing the profile name” section. As Always, use at your own risk rules apply.

Hope this will help.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

8 Responses to Opening Multiple Instances of Firefox

  1. Pingback: Opening Multiple Instances of Safari or Firefox on Mac OS X | Welcome to the website of Mohammad Abouali

  2. jsherk says:

    Thanks for giving fix for newer Firefox versions!

  3. Jonathan says:

    Any idea how you could use everything from the original profile EXCEPT the currently open browser tabs? This script works great except that it opens up a duplicate copy of all my zillions of tabs each time I run it. When I need another instance, it’s specifically so that I can start with a “fresh palette” if you will, and I’d like all my adons and bookmarks, but not the currently open tabs. Any way to do that?

    • Jonathan says:

      Answered my own question… I first created a new profile called “fresh” and copied my extensions into it. On launch they all prompted me to reinstall them and I did so. Then I modified your script above to use “fresh” rather than “default”. Now I can always launch a new “clean” instance of FF without affecting my primary instance in any way. Nirvana!! =)

    • mabouali says:

      Great. You got the answer. Thanks for sharing the solution with us.

  4. Jonathan says:

    Answered my own question… I first created a new profile called “fresh” and copied my extensions into it. On launch they all prompted me to reinstall them and I did so. Then I modified your script above to use “fresh” rather than “default”. Now I can always launch a new “clean” instance of FF without affecting my primary instance in any way. Nirvana!! =)

  5. jsherk says:

    Okay so this script has two issues:
    (1) When Firefox is not already running, it will open TWO seperate windows instead of one.
    (2) When Firefox is already running, it does not open anymore windows.

  6. Joe says:

    When trying to save your script, I keep getting error:
    “Expected end of line, etc. but found identifier.”

    What is wrong?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s