Skip to content

Advanced Users

yokoffing edited this page Jul 30, 2024 · 12 revisions

Credit: The following content is reproduced and adapted from the pyllyukko project.

Download

Different download methods are available:

  • Clone using git: git clone https://github.com/yokoffing/Betterfox
  • Download and extract the ZIP file containing the latest version.
  • Download the latest user.js directly

Installation

Backups

Do note that these settings alter your browser behavior quite a bit, so it is recommended to either create a completely new profile for Firefox or backup your existing profile directory before putting the user.js file in place.

To enable the Profile Manager, run Firefox with command-line arguments: firefox --no-remote -P

Single profile installation

Copy user.js in your current user profile directory, or (recommended) to a fresh, newly created Firefox profile directory.

The file should be located at:

OS Path
Windows %APPDATA%\Mozilla\Firefox\Profiles\XXXXXXXX.your_profile_name\user.js
macOS ~/Library/Application Support/Firefox/Profiles/XXXXXXXX.your_profile_name
Linux ~/.mozilla/firefox/XXXXXXXX.your_profile_name/user.js
Android /data/data/org.mozilla.firefox/files/mozilla/XXXXXXXX.your_profile_name
Windows (portable) [firefox directory]\Data\profile\

With this installation method, if you change any of user.js settings through about:config or Firefox preferences dialogs, they will be reset to the user.js defined values after you restart Firefox. This makes sure they're always back to secure defaults when starting the browser. However this prevents persistently changing settings you don't consider appropriate. Either edit user.js directly, or use the system-wide installation method described below.

System-wide installation (all platforms)

Generate a file suitable for system-wide installation, by running make with one of the following targets:

  • systemwide_user.js: (the value will be used as default value for all Firefox Profiles where it is not explicitly set, it can be changed in about:config and is kept across browser sessions)
  • locked_user.js: (the value will be used as default value on Firefox profile creation, will be locked and can't be changed) in user.js or in Firefox's about:config or settings.
  • debian_locked.js: Debian specific. Users are not able to override preferences. See #415.

Copy the produced file to the Firefox installation directory. The file should be located at:

OS Path
Windows C:\Program Files\Mozilla Firefox\mozilla.cfg
macOS /Applications/Firefox.app/Contents/Resources/mozilla.cfg
Linux /etc/firefox/syspref.js, for older versions: /etc/firefox/firefox.js
Linux (Debian) /etc/firefox-esr/firefox-esr.js
Linux (Gentoo, Archlinux) /usr/lib/firefox/mozilla.cfg, might also be /usr/lib32/ or /usr/lib64/

Additional installation steps for Windows / OS X / Gentoo / Archlinux

Create local-settings.js in Firefox installation directory, with the following contents:

pref("general.config.obscure_value", 0);
pref("general.config.filename", "mozilla.cfg");

This file should be located at:

OS Path
Windows C:\Program Files\Mozilla Firefox\defaults\pref\
macOS /Applications/Firefox.app/Contents/Resources/defaults/pref
Linux (Gentoo, Archlinux) /usr/lib/firefox/defaults/pref/, might also be /usr/lib32/ or /usr/lib64/

If mozilla.cfg still fails to load, you must add a blank comment to the top of mozilla.cfg like so:

//

Custom policies.json (optional)

Enterprise policies are a way of enforcing browser behavior in an enterprise environment, but can be used by users to do the same. Unlike group policies, policies.json is cross-platform. I have made my own, just like the user.js file, this one can also be found in my repository.

WARNING: These policies are enforced and are usually not modifiable within Firefox. Make sure you go through the file and learn what it does before you use it!

Applying the policies.json file

  1. Download my policies.json (Right click > Save Page As…).
  2. Follow instructions for your platform (this is best done if Firefox was never launched, at least on the profile you use):
  • Microsoft Windows: create a directory called “distribution” where the firefox.exe file is located and place the file “policies.json” there.
  • Apple macOS: create a directory called “distribution” in Firefox.app/Contents/Resources/ and place the file “policies.json” there.
  • Linux: create a directory called “distribution” in the directory where Firefox is located and place the file “policies.json” there.

Additional settings (policies)

Not all Firefox settings can be changed through user.js - some must be set in a separate policies.json file. These policies apply system-wide.

To install policies.json from this repository, simply copy it to the appropriate directory (create it if it does not exist):

OS Path
Windows C:\Program Files\Mozilla Firefox\distribution\
macOS /Applications/Firefox.app/distribution\
Linux (Debian) /etc/firefox-esr/policies/

Note that JSON does not support comments, hence settings are documented in custom *_comment keys. Mozilla maintains a list of available policies: [1] [2]. The Enterprise Policy Generator add-on can be used to generate policies.json files from a graphical interface.

Updating using git

For any of the above methods, you can keep your browser's user.js with the latest version available here: Clone the repository, and create a symbolic link from the appropriate location to the user.js file in the repository. Just run git pull in the repository when you want to update, then restart Firefox:

cd ~/.mozilla/firefox
git clone 'https://github.com/yokoffing/Betterfox.git'
cd XXXXXXXX.your_profile_name
ln -s ../Betterfox/user.js user.js

Verifying

Verify that the settings are effective from about:support (check the "Important Modified Preferences" and "user.js Preferences" sections).

Verify that policies are effective from about:policies.