Firefox default settings

Something I see pop up now and again is questions on how to define certain default settings (proxies, home pages, etc) for all users of Firefox. I was surprised to find that I had never posted on this topic before.

It turns out that you can edit a few files inside the Firefox bundle to set default preference values.
Here’s what I do…

Edit /Applications/Firefox.app/Contents/MacOS/greprefs/all.js

Add the following to the end:

// MyOrganization additions
pref("general.config.obscure_value", 0);
pref("general.config.filename", "firefox_AA.cfg");

Create a file /Applications/Firefox.app/Contents/MacOS/firefox_AA.cfg with the following contents:

// This file sets some default prefs for use at MyOrganization
// and locks down some other prefs.
//

// proxy
pref("network.proxy.autoconfig_url", "http://myorg.com/auto.proxy");
pref("network.proxy.type", 2);

// application updates
lockPref("app.update.enabled", false);
lockPref("app.update.autoUpdateEnabled", false);
lockPref("extensions.update.autoUpdate", false);
lockPref("extensions.update.enabled", false);
lockPref("browser.search.update", false);

// Password Manager
pref("signon.rememberSignons", false);

// Default browser check
pref("browser.shell.checkDefaultBrowser", false);

Edit /Applications/Firefox.app/Contents/MacOS/browserconfig.properties to read:

browser.startup.homepage=http://myorg.com
browser.startup.homepage_reset=http://myorg.com

Firefox default settings

37 thoughts on “Firefox default settings

  1. mike1210 says:

    Many thanks for this. I can get the browser homepage part to work but not the config file. The error message I get is Failed to read the configuration file. Please contact your system administrator. I have checked permissions. I am using Tiger 10.4.11 and Firefox 3.01. Any ideas what I might be doing wrong

  2. I assume you are referring to /Applications/Firefox.app/Contents/MacOS/firefox_AA.cfg. Sounds like a syntax error in the config file. Each line must be valid JavaScript. Look for the simple stuff first, like a missing semicolon at the end of each line. Or try commenting out individual lines (by pre-pending //) until the error goes away, which should tell you which line is bad.

  3. mike1210 says:

    LOL i linked this on I forum I frequent and the forum post is above, how i did that I don’t know lol. I removed all the config file, then tried with pre // on each line but still get same message. Tried on 10.5 also. My Java skills are awful however I noticed that on the below

    // MyOrganization additions
    pref(“general.config.obscure_value”, 0);
    pref(“general.config.filename”, “firefox_AA.cfg”);

    the firefox_AA.cfg is quoted whereas the other values are un-quoted. Without the quotes I don’t get an error but config file makes no effect either 😦

  4. So did you actually create the /Applications/Firefox.app/Contents/MacOS/firefox_AA.cfg file? It sounds a bit like you edited /Applications/Firefox.app/Contents/MacOS/greprefs/all.js, but did not create a valid file at /Applications/Firefox.app/Contents/MacOS/firefox_AA.cfg

    -Greg

  5. mike1210 says:

    Hi Greg,
    Yes I definately made the cfg file, I copied the info from your aticle into it, then tried taking out lines and commenting them out also. I did the browser config, that worked fine, grepprefs/all.js and cfg file

  6. I hope you didn’t leave /Applications/Firefox.app/Contents/MacOS/firefox_AA.cfg verbatim as in the article, as it certainly won’t work without changes. Specifically, this line:

    pref(“network.proxy.autoconfig_url”, “http://myorg.com/auto.proxy”);

    must point to a valid proxy autoconfig URL. Otherwise, you’ll need to configure the proxies manually with lines like:

    pref(“network.proxy.http”, “my.proxy.server”);
    pref(“network.proxy.http_port”, 8080); (Defines and locks http proxy port at 8080)
    pref(“network.proxy.type”, 1); (Signifies “Manual” proxy configuration)
    pref(“network.proxy.no_proxies_on”, “localhost, 127.0.0.1”); (Networks where proxy is not necessary, i.e., exceptions)
    pref(“network.proxy.share_proxy_settings”, true); (Equivalent to the “Use proxy server for all protocols” setting)

  7. mike1210 says:

    Hi Greg,
    I may the first time but took the proxy stuff out after that, as in my place we don’t use any proxies for internet access, the main config I wanted to use was

    // Default browser check
    pref(“browser.shell.checkDefaultBrowser”, false);

    but i got the same error with just that in the config file 😦

  8. That’s just plain odd. Did you set the “obscure.value” to 0 in all.js? Otherwise FF assumes the cfg file is trivially encrypted…

    pref(“general.config.obscure_value”, 0);
    pref(“general.config.filename”, “firefox_AA.cfg”);

    You feel like zipping up the two files and sending them to me?

  9. mike1210 says:

    Rookie Mistake on my part, I made the config file as a rich text file not plain text file. Sorted now and a Big think you to Greg for helping me with this

    Mike 🙂

  10. Martin says:

    I’ll be thrilled to get this to work, but I’m having problems also…

    I’ve tried various other sites’ instructions using the rot13 “encryption”, but I can’t ever get the file right. As soon as I add the line: pref(“general.config.obscure_value”, 0); I quit getting the Configuration Error, but the cfg file is completely ignored. It doesn’t matter what I have in there. I’ve tried with just regular prefs, lockPrefs. I even just tried it with the old rot13 file – it doesn’t work and I don’t get an error.

    Any advice?

    Thank you.

  11. pref(”general.config.obscure_value”, 0); just tells Firefox that your file will be in plain text, which is easiest. Then make sure your .cfg is in the right place (/Applications/Firefox.app/Contents/MacOS/), has the name you said it will in the “pref(“general.config.filename”,” line, and is truly a plain text file. Mike in the comments above had used a GUI text editor that not only saved it as styled text, but had appended a “.rtf” to the filename. If you use the command-line to verify the file location, name, and contents, you might catch one or more of these potential errors.

  12. Martin says:

    Thank you Greg! I decided to start over with a clean Firefox.app and it worked flawlessly. I guess I mucked around too much with the original. Thanks again.

  13. Don’t forget the ability to disable the Import Wizard: create a file /Applications/Firefox.app/Contents/MacOS/override.ini. The contents should be as follows:

    [XRE]
    EnableProfileMigrator=false

  14. Jason says:

    Does anyone know if you can set the default download folder in the same way that you can set the settings mentioned in this article? Thanks

  15. Possibly. Looking at about:config, there are these preferences:

    browser.download.dir string
    browser.download.downloadDir string
    browser.download.useDownloadDir boolean

    On my machine, the first two are set to some gibberish instead of a directory path. It may be a Mac OS alias record. You could try setting them to something like “~/Downloads” and see what happens…

  16. Jeff says:

    Great article! Is there a way to pre-configure Firefox with extensions as well? I have a couple of extensions that I want installed on our image by default. Do you know how this might be done?

    -JEff

  17. Jeff says:

    Thanks for that Greg. Just tried both ways out. Installing the extension in the /Library/App Support only works with FF 3. FF 2 ignored it. I’m stuck with FF 2 for now, so I’m going with the CLI option.

    Both ways work fine, depending on firefox version.

  18. MacMonkey says:

    Hi Greg,
    Thanks a lot for these instructions, they work a treat but I was wondering if its possible to set the bookmarks in the bookmarks toolbar?

    Cheers

  19. It might be possible to manage bookmarks, but not using the techniques in this article, as they’re not controlled as Mozilla preferences (using pref() and lock_pref()).

    I’d experiment with editing /Applications/Firefox.app/Contents/MacOS/defaults/profile/bookmarks.html

    Even if this works, it would only affect brand new profiles, not existing profiles. (Of course your users would dislike you if you overwrote their existing bookmarks…)

    -Greg

  20. Nico Mendiola says:

    OMG…thanks to your macworld pdf that led me to this blog…I now regret not being able to attend your session at the MacIT conference…this are the firefox settings I’ve been looking for all this time.

  21. Nico Mendiola says:

    This is brilliant for our lab machines but I just realized still won’t work with our 1:1 laptop program…since it’ll look for the proxies when they go home. Is there any way firefox will recognize the Location settings? For the meantime we’ve just been using Firefox profiles as an alternative solution.

    1. There is a third-party plugin for Firefox that gets it to use the system proxies (which are in turn affected by network locations), but I think a better solution is to use an autoproxy config URL. This is simply a URL that points to a javascript file on an internal webserver. When the laptop is on the internal network, it can retrieve the autoproxy URL, and uses the internal proxies. When the laptop is on an external network, it can’t retrieve the autoproxy info, and so goes direct, not using a proxy.
      If your webserver is externally accessible as well, you can add logic to the javascript so that it determines whether or not to use the proxies based on the machine’s IP address.
      This approach means the user doesn’t have to remember to switch locations or reconfigure proxies – things “just work”.

  22. “Must this file be created within the FF app itself?”

    Only if you want it to work 🙂 Firefox will only look in certain places for it. I don’t know where all those places are – there may be an external path like /Library/Application Support/Firefox that might work…

  23. I’ve just gone hog wild locking things I don’t want my users to mess with. Excellent! Are there any prefs which are known to cause disaster if lockPref()’ed?

    Secondly,

    Chris G writes:

    “Don’t forget the ability to disable the Import Wizard: create a file /Applications/Firefox.app/Contents/MacOS/override.ini. The contents should be as follows:

    [XRE]
    EnableProfileMigrator=false”

    Can’t one just modify the line in /Applications/Firefox.app/Contents/MacOS/application.ini so that it reads: EnableProfileMigrator=0 ?

  24. In Terminal,

    vi /Applications/Firefox.app/Contents/MacOS/greprefs/all.js

    or right-click/control-click on Firefox.app, Show Contents, then drill down through Contents/MacOS/greprefs and use a GUI text editor, but make sure you save as plain text (not Rich Text) and that you don’t add a “.txt” extension to the end of the filename.

Comments are closed.