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

Explore posts in the same categories: General, OS X

37 Comments 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. GregN Says:

    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. [...] to manage the screen saver settings via workgroup manger (plist import) and stumbled across this Firefox default settings « Managing OS X browser config works for me but config file refuses to play [...]

  4. 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 :-(

  5. GregN Says:

    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

  6. 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

  7. GregN Says:

    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)

  8. 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 :-(

  9. GregN Says:

    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?

  10. mike1210 Says:

    Hi Greg,
    Yep no probs, what is your email addy?

    Mike :-)

  11. 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 :-)

  12. 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.

  13. GregN Says:

    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.

  14. 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.

  15. Chris G Says:

    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

  16. 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

  17. GregN Says:

    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…


  18. I did mine a little different. I created a separate .cfg file and was able to use lockPrefs. Nice in that it puts it all into one file rather than several locations.

    http://1laptop1student.blogspot.com/2008/06/locking-down-firefox-in-mac.html

  19. 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

  20. GregN Says:

    Big hint here:

    http://www.mozilla.org/projects/firefox/extensions/commandlineoptions.html

    /Applications/Firefox.app/Contents/MacOS/firefox-bin -install-global-extension “/path/to/extension”

  21. Jeff Says:

    That worked perfect, thanks Greg.

  22. GregN Says:

    Even better:

    http://developer.mozilla.org/en/Installing_extensions

    Mac OS X
    To install an extension to be used by all users on Mac OS X, copy it to:

    /Library/Application Support/Mozilla/Extensions/appid
    To install an extension just for a specific user, place it in that user’s library folder hierarchy:

    ~/Library/Application Support/Mozilla/Extensions/appid

  23. 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.

  24. 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

  25. GregN Says:

    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

  26. 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.

  27. 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.

    • GregN Says:

      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”.

  28. Derek Smith Says:

    “Create a file /Applications/Firefox.app/Contents/MacOS/firefox_AA.cfg”

    Must this file be created within the FF app itself? Can it be external?

  29. GregN Says:

    “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…

  30. Derek Smith Says:

    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 ?


  31. [...] Firefox default settings Managing OS X [...]


  32. How do you edit the /Applications/Firefox.app/Contents/MacOS/greyprefs/all.js In Terminal? How do you get there?

  33. GregN Says:

    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.

  34. islam Says:

    You’r precisely correct on this one..


Comments are closed.


Follow

Get every new post delivered to your Inbox.

Join 183 other followers

%d bloggers like this: