Building Firefox On Windows¶
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.
If you’d prefer to build Firefox for Windows in a virtual machine, you may be interested in the Windows images provided by Microsoft.
Memory: 4GB RAM minimum, 8GB+ recommended.
Disk Space: At least 40GB of free disk space.
Operating System: Windows 10. It is advisable to have Windows Update be fully up-to-date. See Supported Build Hosts for more information.
1. Install MozillaBuild¶
Accept the default installation directory. Windows may prompt you to “reinstall with the correct settings”, which you should click to accept.
When working with Firefox tooling, you’ll need to do so from within the MozillaBuild
shell. You can start it by running
C:\mozilla-build\start-shell.bat (you may want
to make a shortcut to this file so it’s easier to start).
The MozillaBuild shell is a lot more like a Linux shell than the Windows
cmd. You can
learn more about it here.
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.
# Using the C:\mozilla-build\start-shell.bat shell from step 1: cd c:/ mkdir mozilla-source cd mozilla-source wget https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py python3 bootstrap.py
bootstrap.py there will be a UAC (User Account Control) prompt for PowerShell after
selecting the destination directory for the source code clone. This is
necessary to add the Microsoft Defender Antivirus exclusions automatically. You
Yes on the UAC prompt, otherwise you will need
to follow some manual steps below.
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¶
Ensure antivirus exclusions¶
Microsoft Defender Antivirus and some third-party antivirus products are known to significantly degrade build times and sometimes even cause failed builds (due to a “missing file”). This is usually because we have tests for well-known security bugs that have code samples that antivirus software identifies as a threat, automatically quarantining/corrupting the files.
To avoid this, add the following folders to your third-party antivirus exclusion list:
The directory where the Firefox code is (probably
bootstrap.py script attempts to add the above folders to the Microsoft
Defender Antivirus exclusion list automatically. You should check that they were
successfully added, but if they’re missing you will need to add the exclusions to
Microsoft Defender Antivirus manually.
If you’re already missing files (you’ll see them listed in
hg status, you can have them
brought back by reverting your source tree:
hg update -C).
Now that your system is bootstrapped, you should be able to build!
cd c:/mozilla-source/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.
If you’d like to interact with Mach from a different command line environment than MozillaBuild, there’s experimental support for it described over here.
The build system expects that you’re using the most-recent MozillaBuild release. However, MozillaBuild doesn’t auto-update. If you’re running into local issues, they may be resolved by upgrading your MozillaBuild.
Spaces in folder names¶
Firefox will not build if the path to MozillaBuild or the Firefox source contain spaces or other breaking characters such as pluses, quotation marks, or metacharacters. The Visual Studio tools and SDKs are an exception - they may be installed in a directory which contains spaces. It is strongly recommended that you accept the default settings for all installation locations.
Quotation marks in
Quotation marks (”) aren’t translated properly when passed to MozillaBuild
sub-shells. Since they’re not usually necessary, you should ensure they’re
not in your
PATH environment variable.
PYTHON environment variable¶
PYTHON is set, the build may fail with the error: “
cannot find the file specified.” Ensure that you aren’t having
PYTHON environment variable set.
If you happen to have Cygwin installed, its tools may erroneously be
used when building Firefox. Ensure that MozillaBuild directories (in
C:\mozilla-build\) are before Cygwin directories in the