Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Open Firefox with a clean profile Apps
I just finished writing an AppleScript that will let you run Firefox with a clean profile. If Firefox isn't already running when you run this script, it'll open Firefox normally, but load a clean profile instead of the default one. If Firefox is running, the script will open a new instance of Firefox alongside the current one and load the clean profile in that. If you already have both your default profile and the clean profile open, it'll just bring the clean one into focus.

Before we get to the actual script, you'll need to open Firefox's profile manager and create a new profile. Open a new Terminal window and type this:
/Applications/Firefox.app/Contents/MacOS/firefox -profilemanager
...then hit Return. This assumes that Firefox is in the Applications folder; if you have it somewhere else, change the path to wherever you put it. When the Profile Manager opens, click Create Profile, and name it whatever you want (I used "Clean"). If your profile name is longer than one word, make sure you use underscores or dashes instead of spaces. Once you're done, click Exit. Now for the script. Copy and paste this into Script Editor:

on run
   set ffPath to "/Applications/"
   set ffName to "Firefox"
   set ffProfile to "clean"

   set findFF to "ps -ef | grep firefox | grep -v grep | grep -v sh | awk '{print$2}'"
   set pinfo to do shell script findFF
   set oldPnum to count words of pinfo
   if oldPnum is less than 2 then
       do shell script ffPath & ffName & ".app/Contents/MacOS/firefox -P " & ffProfile & " &> /dev/null &"
   end if
   set newPnum to oldPnum
   repeat while newPnum = oldPnum
       delay 0.25
       set pinfo to do shell script findFF
       set newPnum to count words of pinfo
   end repeat
   if newPnum is less than 2 then
       set ffPID to word 1 of pinfo as integer
   else
       set ffPID to word 2 of pinfo as integer
   end if
   tell application "System Events" to set frontmost of every process whose unix id is ffPID to true
end run
This script assumes that Firefox is in the Applications folder, that it's named "Firefox", and that the profile is named "clean". If not, then change those variables at the top of the script to match your setup. You can also tell Firefox to load a specific URL when it opens, by adding a space and then the website after the profile name. For example, changing "clean" in the script to "clean http://google.com" will load the clean profile and take you to the Google home page. Once everything's in order click File: Save as, make sure that Startup Screen is unchecked, and save it as an Application Bundle.

[editor adds: I have not tested this hint.]
    •    
  • Currently 1.71 / 5
  You rated: 2 / 5 (7 votes cast)
 
[15,161 views]  

Open Firefox with a clean profile | 3 comments | Create New Account
Click here to return to the 'Open Firefox with a clean profile' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Open Firefox with a clean profile
Authored by: fritztoch on Aug 18, '09 07:49:02AM

I haven't had enough coffee yet so please be gentle, but the only use I have had in the past for creating a new Firefox profile is to test for a corrupt (existing) profile.
What other uses do you have for "clean" profiles that would necessitate a script to automate it?



[ Reply to This | # ]
Open Firefox with a clean profile
Authored by: drudus on Aug 18, '09 09:02:13AM

Possible usage.
A shared computer (kiosk) that isn't managed by OSX Server.
eg turn on Simple Finder, change the scripts icon to FireFox's, add it to the Dock. This way users don't get the previous days history & potentially weird layout that the previous user mangled within Firefox.

Not a perfect solution, but it'll work.



[ Reply to This | # ]
Open Firefox with a clean profile
Authored by: CaptnEvilStomper on Aug 19, '09 12:02:45AM

@birddog: You don't necessarily have to keep the extra profile completely clean. The point of the script is just to allow you to switch between a main profile and a secondary profile without having to restart Firefox and without having to use the profile manager. For example, say you're creating a Firefox theme or extension. You could have your main profile for daily use and a separate profile that you only use for testing the new theme or extension. If you're working on more than one extension or theme you could even save multiple versions of the script and create multiple profiles with customized test environments for each extension or theme.

Personally, I wanted a second profile because I'm writing a few different user styles for use with Stylish and I found myself constantly disabling and enabling AdBlock Plus, switching between my current theme and the default one, etc., all of which required me to restart Firefox. With the script I can just open my secondary profile that only has DOM Inspector and Stylish installed and test my user styles in that.



[ Reply to This | # ]