Building Firefox On macOS¶
This document will help you get set up to build Firefox on your own computer. Getting set up can take a while - we need to download a lot of bytes! Even on a fast connection, this can take ten to fifteen minutes of work, spread out over an hour or two.
Memory: 4GB RAM minimum, 8GB+ recommended.
Disk Space: At least 30GB of free disk space.
Operating System: macOS - most recent or prior release. It is advisable to upgrade to the latest “point” release. See Supported Build Hosts for more information.
1. System preparation¶
1.1. Install Brew¶
Mozilla’s source tree requires a number of third-party tools. You will need to install Homebrew so that we can automatically fetch the tools we need.
1.2. Install Xcode¶
Install Xcode from the App Store. Once done, finalize the installation in your terminal:
sudo xcode-select --switch /Applications/Xcode.app sudo xcodebuild -license
1.3 Install Mercurial¶
Mozilla’s source code is hosted in Mercurial repositories. You will
need Mercurial to download and update the code. Additionally, we’ll
put user-wide python package installations on the
$PATH, so that
moz-phab will be easily accessible:
echo 'export PATH="'"$(python3 -m site --user-base)"'/bin:$PATH"' >> ~/.zshenv python3 -m pip install --user mercurial
Now, restart your shell so that the
PATH change took effect.
You can test that Mercurial is installed by running:
If you’re using a shell other than
zsh, you’ll need to manually add Python’s
bin directory to your
PATH, as your shell probably won’t pick up our
2. Bootstrap a copy of the Firefox source code¶
Now that your system is ready, we can download the source code and have Firefox automatically download the other dependencies it needs. The below command will download a lot of data (years of Firefox history!) then guide you through the interactive setup process.
curl https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py -O python3 bootstrap.py
git, you can grab the source code in “git” form by running the
bootstrap script with the
python3 bootstrap.py --vcs=git
This uses Git Cinnabar under the hood.
Choosing a build type¶
Now that your system is bootstrapped, you should be able to build!
cd mozilla-unified hg up -C central ./mach build ./mach run
🎉 Congratulations! You’ve built your own home-grown Firefox!
Now the fun starts¶
Time to start hacking! You should join us on Matrix, say hello in the Introduction channel, and find a bug to start working on. See the Firefox Contributors’ Quick Reference to learn how to test your changes, send patches to Mozilla, update your source code locally, and more.