I admit it: I have problems staying focused sometimes. I work on the Web all day, and the Web is full of distractions. The Firefox awesome bar doesn’t help matters — all I have to do is type a couple of letters into the awesome bar and it shows me suggestions of all sorts of fascinating, amusing, non-work-related websites. Total distraction is always just a few keystrokes away.


If only I could separate all my websites into ‘work’ websites and ‘fun’ websites, and somehow ensure that when I’m at work, Firefox only suggests the work websites, but when I’m at home, it suggests the fun websites.

Last week, I realized there’s actually a pretty easy way to do this, by splitting my Firefox profile into two profiles. It’s been working out pretty well for me so far; my random websurfing at work has gone way, way down.

Firefox profiles are an extremely powerful feature, but unfortunately many people who could make use of profiles don’t know they exist, because the interface to the feature is hidden. The rest of this post will walk you through the steps to enable profiles, split your profile into a ‘work’ and a ‘fun’ profile, and then purge all of the non-work-related stuff out of the ‘work’ profile.

Let’s get started. Open up a command line and launch Firefox with a ‘-P’ flag (see below for the command line to use on each platform, assuming your Firefox is installed in the default location):

/Applications/Firefox.app/Contents/MacOS/firefox -P
"C:\Program Files\Mozilla Firefox\firefox.exe" -P
/usr/bin/firefox -P

The ‘-P’ flag causes Firefox to display the Profile Manager on startup. The profile manager looks like this:


Uncheck ‘don’t ask on startup’, so that from now on you will be asked which profile you want to use, each time you start Firefox.

Next, create two new profiles, called ‘work’ and ‘fun’. What you really want to is to copy your default profile into these two new profiles. There is no ‘copy profile’ button, unfortunately. So the next step is to exit Firefox and manually copy all the goodies from your default profile into ‘work’ and ‘fun’.

Your profile directories are located at:

~/Library/Application Support/Firefox/Profiles/

If you’re not a command-line user, you can get there through the GUI: on Mac, start in your home folder, then open Library, then Application Support, then Firefox, then Profiles. On Windows, you can type or copy %APPDATA%\Mozilla\Firefox\Profiles\ into the location bar of a file explorer window. On Linux — well, it depends on what window manager you’re using, but the .mozilla directory inside your home directory is invisible by default, so you’ll have to figure out how to make it visible; using the command line might actually be easier.


Each profile is a directory named something like:


A bunch of random letters and numbers, followed by a period and then the name that you gave the profile. Your default profile (the one Firefox created for you, that you’ve probably been using so far) is called “xxxxxxxx.default”. If you just created two profiles called ‘work’ and ‘fun’, you should see folders called “xxxxxxxx.work” and “xxxxxxxx.fun”. So what you want to do is to take all of the files from inside the default profile folder, and copy them all into the work profile folder. Then copy them again into the fun profile folder. If a message comes up asking you if you want to replace files with the same name, say yes.

Once that’s done, the next step is to cleanse the ‘work’ profile of everything that’s not work-related. Start up Firefox again. You can launch it normally, from the GUI, this time. You should be prompted to choose a profile. When Firefox starts up, choose the ‘work’ profile.

Go to the history menu and choose ‘show all history’. Click in the ‘search history’ box. Type in the domain of your favorite distraction website. For instance, one of my favorites is ‘fivethirtyeight.com’ (a politics blog):


Now click in the main area, hit control-A (or cmd-A) to do Select All, and hit Delete. If there are a lot of items, the history manager will take a few seconds to delete everything.

Repeat this process for all the rest of the websites you use to distract yourself. Instead of the domain name, you can also enter a word to find all the pages with that word in their page title or URL.

I deleted everything containing the words ‘rpg’, ‘comics’, ‘politics’ — my favorite subjects for self-distraction — plus everything from youtube, ebay, amazon, livejournal, failblog, xkcd, qwantz, achewood, theonion, cnn, tvtropes, penny-arcade, etc. etc… (Wikipedia I kept, because about half of my Wikipedia browsing history is work-related.)


When done purging history, I did the same with bookmarks. You can get to the bookmark view from the history view just by clicking “all bookmarks” in the left sidebar, followed by “bookmarks menu”. I got rid of, again, everything tagged ‘rpg’, ‘comics’, and ‘politics’, all my saved news articles about Somali pirates and experimental robots, all my bookmarked youtube videos of He-Man cartoons and essays about the history of Dungeons & Dragons and tutorials on how to paint Warhammer 40k miniatures.


All of those bookmarks and history items still exist in my ‘fun’ profile, but my ‘work’ profile is now completely clean. When I type into the awesome bar, all I see is sites related to work!


Distracting myself with websurfing is now much less convenient. Ugh! I have to type in a whole URL? I might as well go back to writing code!

Additionally, because I put in the effort to make my ‘work’ profile pristine, I feel a motivation to keep it pristine, which makes me not want to let even one webcomic URL get into the history of my work profile. Maybe that’s just due to my own personal psychology, but it’s one of the things that helps me resist the temptation.

What if you want to use both profiles at once? Normally if you try to launch Firefox while Firefox is already running, you’ll just switch to the running copy of Firefox. But you can override this behavior and force Firefox to run two separate, independent copies, by launching from the command line with the ‘-no-remote’ flag. Like this:

/Applications/Firefox.app/Contents/MacOS/firefox -no-remote
"C:\Program Files\Mozilla Firefox\firefox.exe" -no-remote
/usr/bin/firefox -no-remote

Then you can have one copy running the ‘work’ profile and the other running the ‘fun’ profile. Doing this is a little bit of a pain, but I think that’s actually a feature, not a bug: the harder it is to switch between ‘work’ and ‘fun’, the easier it is for me to stick to the ‘work’ profile until the workday is done.

There are lots more uses for profiles too. I created a ‘guest’ profile, and I switch to it whenever I’m letting someone else use the web on my computer. Not only does it protect my privacy (no logging in to my bank account with Firefox’s saved password!) but it also ensures my guest gets the normal Firefox behavior, without all the experimental add-ons and weird customizations that I use in my main profile.