This page covers the basic steps needed to build a bleeding-edge, development version of Firefox. For additional, more detailed information, see the build documentation.
- While you can build Firefox on older hardware it can take quite a bit of time to compile on slower machines, and having at least 8GB of RAM is recommended.
- Fast broadband internet is strongly recommended as well. Both the development environment and the source code repository are quite large.
- You must have a 64-bit operating system. As of early 2015 it is no longer possible to build Firefox on most 32-bit machines.
Depending on your Operating System you will need to carry out a different process to prepare your machine. So firstly complete the instructions for your OS and then continue following these build instructions.
Get the source
Get the latest source code from Mozilla's Mercurial code repository. This may take a while; it's a lot of code!
hg clone https://hg.mozilla.org/mozilla-central
If you are using a slow or unreliable internet connection, "hg clone" might fail because it gets interrupted. In that case, you are strongly encouraged to download a Mercurial bundle file instead of waiting for "hg clone".
Build configuration (optional)
By default, the build system creates a release build of Firefox roughly equivalent to the official Firefox release builds. If that's not exactly what you want, there are many build configuration options to choose from, although it's strongly recommended that you only use options that you fully understand.
The normal way to specify build options is to place them in a file named
mozconfig at the root of your mozilla source tree (that is, directly under the
mozilla-central directory created by the
hg clone command). On Windows, you can create the file from the MozillaBuild command-line:
cd /path/to/mozilla-central touch mozconfig
For example, if you're planning on hacking the C/C++ code, you probably want to create a debug build instead of a release build, by adding the following lines to
ac_add_options --enable-debug ac_add_options --disable-optimize
For more on configuration options, see the page on configuring build options.
To configure mercurial for
If you want to disable this tools check (ex. You just want to build Firefox), you set NO_MERCURIAL_SETUP_CHECK environment value to 1 like the following.
If you have an anti-virus program installed on your machine, you may need to add the object directory (by default, under
mozilla-central/ prefixed with
obj-i686-pc-mingw32) to the anti-virus program's exclusion list. Programs like Norton Security Suite (on Windows) sometimes identify executables or files generated by the build process as a security threat and as a result delete them or stop them from running. This typically causes the build to fail. Even when the build doesn't fail, the resulting checks often result in much slower build times.
To start the build, cd into the
mozilla-central subdirectory (created automatically by the
hg clone command), and run:
mach is our command-line tool to streamline common developer tasks. See the mach article for more.
The first time you run "./mach build", mach will ask you if you'd like to create a ".mozbuild" directory in your home folder and wait 20 seconds for your answer. This is a good default setting, and you should allow it to finish.
Building can take a significant amount of time, depending on your system, OS and chosen build options (e.g., Linux builds on a fast box may take under 15 minutes, but Windows builds on a slow box may take several hours). See tips for making builds faster.
Various temporary files, libraries, and the Firefox executable will be found in your object directory (under
mozilla-central/), which is prefixed with
obj-. The exact name depends on your system and OS. For example, a Mac user may get an object directory name of
To run the newly created Firefox instance, use the mach command
The Firefox executable and its dependencies are located under the
dist/bin folder under the object directory. In particular, Firefox is (depending on the OS) at
- OS X:
To build after making changes, run
again. This will only rebuild what is necessary for these changes. It is also possible to use
./mach build path/to/dir
to build parts of the tree. However, this approach may or may not yield correct results, so it is not recommended.
How to update
To pull the latest changes and update the code in your
mozilla-central working directory, run the command:
hg pull -u
./mach build. Due to the high rate of changes to Firefox, this may take quite a long time.