This document will help you get set up to build Firefox on your own computer. Getting set up won't be difficult, but it 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.

The details are further down this page, but this quick-start guide should get you up and running:

One-Line Setup (Try This First!)

Xcode is a prequisite to build Firefox an you will need administrator permissions on your machine to install it.  You can verify that you have these permission in System Preferences -> Users & Groups.) You will also need:

  • an Apple ID (to install Xcode)
  • 1 hour (to download and install Xcode, which is large)
  • macOS SDK headers

See "The Details", "Install Apple-distributed developer tools" below for more information on install prerequsites.

Getting the source


If you don’t have one yet, create a "src" directory for yourself under your home directory:

mkdir src && cd src

Next download the script and save it in the src/ directory created above.

And finally, in your terminal from above start the bootstrapper like this:


... and follow the prompts. This will use mercurial to checkout the source code. If you prefer to work with git, use this command instead:

python --vcs=git

If you don't have Homebrew or Ports installed - software package managers that will let us install some programs we'll need - you'll be asked to pick one. Either will work, but most Mozilla developers use Homebrew.

If you don't let the script clone the source for you make sure you do it manually afterwards before moving onto the next step.


Build Firefox!

Now we tie it all together. In your terminal window, cd to your source directory as before and type

cd mozilla-unified

./mach bootstrap

./mach build

The ./mach bootstrap step is a catch-all for any dependencies not covered in this documentation. If you are working on Firefox frontends or building Firefox without any changes, select artifact builds in the first question in ./mach bootstrap.  Artifact builds will complete more quickly!  Artifact builds are unsuitable for those working on C++ code.

You’re on your way. Don’t be discouraged if this takes a while; it takes some time even on the fastest modern machines and as much as two hours or more on older hardware. Firefox is pretty big, because the Web is big.


Getting Connected

That last step can take some time to finish. While it’s running, take a moment to sign in to Bugzilla, Mozilla’s issue tracker. To comment on a bug or submit a patch you’ll need a Bugzilla account. You can either use your GitHub account, or you can sign up for a Bugzilla account here.

As well as Bugzilla, much of Mozilla’s internal communication happens over Internet Relay Chat (IRC). You can learn how to connect to Mozilla with IRC here. If you’re just getting started or have questions about getting set up you can join us in the "#introduction channel", where some of our community members hang out to try and help new contributors get rolling.


There’s one more thing you can do for yourself while you’re waiting: create an account for yourself on Mozillians. Mozillians is the Mozilla community directory, where you can connect with people who share your interests, projects or countries. This step is optional, but we think it will be worth your while.

Now the Fun Starts

You have the code, you’ve compiled Firefox. Fire it up with ./mach run and you’re ready to start hacking. The next steps are up to you: join us on IRC in the#introduction channel, follow StartMozilla on Twitter and find a bug to start working on.

Thank You

Mozilla's strength is the community behind it; Firefox is the product of a global development team working to keep the Web free, open and participatory, and your contributions will make Firefox and the Web better for hundreds of millions of people around the world.

The Details

If you run into problems, see the Mozilla Build Frequently Asked Questions or the rest of the Mozilla build documentation.

Once your build environment is complete, proceed to Step 3 below.

Build Steps (Details)

Building on macOS is divided into the following steps:

  1. Install Apple-distributed developer tools
  2. Install supplementary build tools
  3. Obtain a copy of the Mozilla source code
  4. Configure the Mozilla source tree to suit your needs
  5. Build Firefox

1. Install Apple-distributed developer tools

You first need to install Xcode, for which you have two options:

  • If you want to avoid giving Apple your credit card details to obtain a Apple developer subscription you can download Xcode from the More Downloads for Apple Developers page. Download the latest stable (non-beta) version of Xcode, open Xcode.xip, and then before running the extracted, move it from the download folder to /Applications. (Running it from another location may screw up various build paths, homebrew builds, etc. Fix by running sudo xcode-select -switch /Applications/
  • Use the App Store.

Open /Applications/ and let it do its initial first run and setup stuff.

Install the Xcode command line tools by running xcode-select --install in your terminal.

The macOS SDK is needed to build Firefox. Xcode comes with the current version's headers. For example, you can install the macOS SDK headers by running open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg in your terminal.

However, Firefox will currently not run with the 10.14 (Mojave) headers (see bug 1475652). A good choice is the 10.11 (Mavericks) SDK, which is used for the official macOS build. These headers are included in Xcode 7.3.1, and a tool like xcodelegacy can be used to extract the SDK without installing the old Xcode version.

2. Install supplementary build tools

Mozilla's source tree requires a number of third-party tools and applications to build it. You will need to install these before you can build anything.

You have the choice over how to install all these components. You can use a package manager like Homebrew or Ports. Or, you can obtain, compile, and install them individually. For simplicity and to save your time, using a package manager is recommended. The following sections describe how to install the packages using existing package managers. Choose whatever package manager you prefer.

2.1a Install Dependencies via Homebrew

Homebrew is "the missing package manager for macOS." It provides a simple command-line interface to install packages, typically by compiling them from source.

The first step is to install Homebrew. See

Once you have Homebrew installed, you'll need to run the following:

brew install yasm mercurial gawk ccache python

You will also need Autoconf 2.13, but the core Homebrew repository will install a newer version by default, so you need to specify the version when installing it:

brew install autoconf@2.13

If you get errors trying to build, it means you have another version of Autoconf installed and used as default. To use Autoconf 2.13, run:

​brew link --overwrite autoconf@2.13


2.1b Install Dependencies via MacPorts

MacPorts is a package manager for macOS. If you are running Homebrew, you can ignore this section.

To install MacPorts, go to their install page, download the .dmg for your platform, and install it. If you already have MacPorts installed, ensure it is up to date by running:

sudo port selfupdate
sudo port sync

The first of these commands will ask for your root password.

Common errors include:

  • sudo doesn't accept a blank password: create a password for your account in System Preferences.
  • port command not found: add it to your path (see the troubleshooting section below).

Use MacPorts to install the packages needed for building Firefox:

sudo port install libidl autoconf213 yasm

You'll then see lots of output as MacPorts builds and installs these packages and their dependencies -- it takes a while, so go grab a cup of coffee.

Note: By default, this will install Python 2.7, which in turn will pull in all of the X11 libraries, which may take a while to build.  You don't need any of those to build Firefox; you may want to consider adding +no_tkinter to the install line to build a python without support for the X11 UI packages.  This should result in a much faster install.
Note: With older versions of Xcode (eg 6.4) you may need to use MacPorts to get the proper version of clang, such as clang-3.6 or later. See bugs in Core, Build Config referring to clang.

2.2 Install Mercurial

Mozilla's source code is hosted in Mercurial repositories. You use Mercurial to interact with these repositories. There are many ways to install Mercurial on macOS:

  1. Install official builds from Selenic
  2. Install via MacPorts:
    sudo port install mercurial
  3. Install via Homebrew:
    brew install mercurial
  4. Install via Pip:
    easy_install pip && pip install mercurial

Once you have installed Mercurial, test it by running:

hg version

If this works, congratulations! You'll want to configure your Mercurial settings to match other developers. See Getting Mozilla Source Code Using Mercurial.

If this fails with the error "ValueError: unknown locale: UTF-8", then see the workarounds on the Mercurial wiki's Unix Install page.

When trying to clone a repository you may get an HTTP 500 error (internal server error). This seems to be due to something that Mac Mercurial sends to the server (it's been observed both with MacPort and Mercurial binaries). Try restarting your shell, your computer, or reinstall Mercurial (in that order), then report back here what worked, please.

3. Obtain a copy of the Mozilla source code

You may want to read Getting Mozilla Source Code Using Mercurial for the complete instructions. If you are interested in Firefox development:

# The following will create a new directory, Mozilla-central, in the
# current one with the contents of the remote repository. This command
# will take many minutes to run, as it will be copying a couple hundred
# megabytes of data over the internet.

$ hg clone Mozilla-central
$ cd Mozilla-central

(If you are building Firefox for Android, you should now return to the Android build instructions.)

4. Configure the Mozilla source tree for build options

In your checked out source tree, you'll create a new file, .mozconfig, which contains your build options. For more on this file, see Configuring Build Options.

To quickly get started, create the file .mozconfig file in your source tree clone with the following contents:

# Define where build files should go. This places them in the directory
# "obj-ff-dbg" under the current source directory
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-ff-dbg

# Enable debug builds
ac_add_options --enable-debug

Builds require the 10.9 SDK or higher. If you'd like to ensure compatibility with an operating system version previous to the one you are building on, you can explicitly specify an SDK by adding a line like this:

ac_add_options --with-macos-sdk=/Applications/

Or, check the /Applications/ directory to see which SDKs are installed, and pick one to add into your .mozconfig.

Firefox no longer builds with gcc 4.8 or earlier, but the build system should automatically select clang if it is available in the PATH. If that is not the case, you need to set CC and CXX. For instance, if you installed Clang 3.7 via Homebrew, then you need to have


If you installed Autoconf 2.13 with the Homebrew recipe linked above, you may need to add the following to your .mozconfig:

mk_add_options AUTOCONF=/usr/local/Cellar/autoconf@2.13/2.13/bin/autoconf213

5. Build

Once you have your .mozconfig file in place, you should be able to build!

./mach build

If the build step works, you should be able to find the built application inside obj-ff-dbg/dist/. If building the browser with --enable-debug, the name of the application is To launch the application, try running the following:

./mach run
Note: The compiled application may also be named after the branch you're building; for example, if you changed these instructions to fetch the mozilla-1.9.2 branch, the application will be named or

Hardware requirements

There are no specific hardware requirements, provided that the hardware accommodates all of the software required to build Firefox. Firefox can take a long time to build, so more CPU, more RAM and lots of fast disks are always recommended.

  • Processor: Intel CPUs are required. Building for PowerPC chips is not supported.
  • Memory: 2GB RAM minimum, 8GB recommended.
  • Disk Space: At least 30GB of free disk space.

Software requirements

  • Operating System: Mac OS X 10.9 or later. It is advisable to upgrade to the latest “point” release by running Software Update, found in the Apple menu. You will need administrative privileges to set up your development environment
  • Development Environment: Xcode. You can obtain from the App Store.
  • Package Management: Either MacPorts or Homebrew.
  • autoconf version 2.13 is needed if you plan on making changes to the Mozilla files on versions up to 1.9 and when building from Mozilla-central. Newer versions of Autoconf, including those that come with Xcode and installed in /usr/bin, are incompatible with Mozilla (bug 104642). You can install Autoconf 2.13 from either MacPorts or Homebrew.
  • Mercurial source control system (if you're planning to work on post-1.9.0 code). See Mercurial for Mozillians for specifics on installing on macOS.

These options are specific to Mozilla builds for macOS. For a more general overview of build options and the .mozconfig file, see Configuring Build Options. For specific information on configuring to build a universal binary, see Mac OS X Universal Binaries.

  • Compiler: Firefox releases are no longer built with gcc-4.8 or earlier. A recent copy of clang is needed.
    • There are some options on where to get clang:
      • Newer versions of Xcode. The one in Xcode 7.0 or newer and the open source 3.6 release should work.
        (Xcode 6.4 is based on pre-release of clang 3.6, that doesn't match to requirement.)
      • Following the instructions in the clang website for information on how to get it.
      • Using some of the package managers (see above).
    • Once clang is installed, make sure it is on the PATH and configure should use it.

The following options, specified with ac_add_options, are lines that are intended to be added to your .mozconfig file.

  • macOS SDK: This selects the version of the system headers and libraries to build against, ensuring that the product you build will be able to run on older systems with less complete APIs available. Selecting an SDK with this option overrides the default headers and libraries in /usr/include, /usr/lib, and /System/Library. Mac macOS SDKs are installed in /Developer/SDKs during the Xcode installation by selecting the Cross Development category in the installer’s Customize screen.
    ac_add_options --with-macos-sdk=/path/to/SDK

    Official trunk builds use /Developer/SDKs/MacOSX10.11.sdk. Check build/macosx/universal/mozconfig.common for the SDK version used for official builds of any particular source release.

    Applications built against a particular SDK will usually run on earlier versions of Mac macOS as long as they are careful not to use features or frameworks only available on later versions. Note that some frameworks (notably AppKit) behave differently at runtime depending on which SDK was used at build time. This may be the source of bugs that only appear on certain platforms or in certain builds.

For macOS builds, defines are set up as follows:

  • XP_MACOSX is defined
  • XP_UNIX is defined
  • XP_MAC is not defined. XP_MAC is obsolete and has been removed from the source tree (see bug 281889). It was used for CFM (non-Mach-O) builds for the classic (pre-X) Mac OS.

This requires care when writing code for Unix platforms that exclude Mac:

#if defined(XP_UNIX) && !defined(XP_MACOSX)


  • Unable to build with GCC: Apple used to ship a GCC based on vanilla GCC 4.2. They still ship LLVM-GCC (which is also base on GCC 4.2). Mozilla does not support building with any GCC 4.2 variant anymore. On macOS, non-Apple (i.e. stock) GCCs are also not supported (they don't support blocks), so you must use clang on macOS.
  • Using Fink with Virex 7.2: There is a conflict between Fink and Virex 7.2. Both place files within /sw. If you have Virex installed, you will need to upgrade to at least version 7.2.1, as described in the Fink News (2003-04-16).
  • If configure (or generally building with clang) fails with fatal error: 'stdio.h' file not found: Make sure the Xcode command line tools are installed by running. xcode-select --install. [jgilbert] found this necessary during an install for 10.9.
  • For inexplicable errors in the configure phase: Review all modifications of your PATH in .bash_profile, .bash_rc or whatever configuration file you're using for your chosen shell. Removing all modifications and then re-adding them one-by-one can narrow down problems.