Skip to main content

Firefox, profiles, and Linux

Posted by felipeal on February 27, 2007 at 8:18 PM PST

Have you ever spent hours trying to run 2 instances of Firefox on Linux, using command-line arguments (like -ProfileManager) that *used* to work, but now simply open a window in the same Firefox process? If you did, this blog is for you...



First of all, Mozilla-based products like Firefox use profiles. That feature is so useful that it deserves a blog of its own (no, I won´t reinvent the wheel). But basically speaking, it means you can create different profiles, each with its own mozilla data (like cookies, bookmarks, passwords, etc...), and use them simultaneously. This is quite useful when you are developing web applications and must test it as different users. Or in a more mundane (and less development-based) situation, when you need to access a website using 2 different accounts (for instance, I have 2 main GMail accounts, felipeal and felipealists, the former being my main user, and the latter used only for managing mailing lists).



So far, so good - no big news in the scenario I described above. The problem is, the CLI (command-line interface) seems to be broken in more recent versions of Firefox and/or Fedora Core. I.E., if I have a running firefox instance using the default profile, and type the following command in the shell:

firefox -P sidekickProfile

or even:
firefox -ProfileManager

it opens a new window using the same firefox process (and hence using the same profile), instead of starting a new process (with a different profile, or popping up the profile manager window, respectively)!



That issue has been hunting me for many months, but as I just needed that feature a couple of times during this period (and being a professional procrastinator :-), I never had the patience to figure it out what was wrong - I just su-ed to a new user and ran a different instance of firefox (which is an ugly hack).



Well, last week, I finally got ashamed of myself, decided to fight the laziness, and figured out what the problem was! Looks like somewhere in the Firefox/Mozilla evolution (I guess it was Firefox 1.5), the startup scripts assumed the responsibility of deciding if a new process should be started, or if the CLI parameters should be passed to an existing (remote) instance.



Long-story short, in order to achieve the desired (for me, at least) behavior, you must set the variable MOZ_NO_REMOTE, to any value (or even none, as seem in the second example below - don't ask me why, I've never seem such behavior before!). For instance:


MOZ_NO_REMOTE=hell,yes firefox -P sidekickProfile
MOZ_NO_REMOTE= firefox -ProfileManager

Or, in a nice Unix way, create aliases to do the job:


alias ff2=`MOZ_NO_REMOTE= firefox -P sidekickProfile`
alias pm=`MOZ_NO_REMOTE= firefox -ProfileManager`

As a final note, I will leave here my 2-cents rant: why have this behavior changed in recent versions of Firefox? I mean, I´m fine with the script taking the responsibility of reusing existing process (I guess that burden was taken care off by the Linux/Unix integration before), but once you *explicitly* pass CLI arguments to invoke the profile manager, why the hell should the script pass them to a running process???

Related Topics >>