This document will help you get set up to build Firefox on your owncomputer. 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 cantake ten to fifteen minutes of work, spread out over an hour or two.
Learn the best of web development. Get the latest and greatest from MDN delivered straight to your inbox. The newsletter is offered in English only at the moment. Firefox Mac OS X 10.9, 10.10 and 10.11 users move to Extended Support Release Installing Firefox on Mac Visit the Firefox download page in any browser (for example, Safari).
The details are further down this page, but this quick-start guideshould get you up and running:
Quick start (Try this first!)
Prerequisites
You will need:
an Apple ID to download and install Apple-distributed developer toolsmentioned below
from 5 minutes to 1 hour to download and install Xcode, which islarge
download and install a local copy of specific macOS SDK version
You will need administrator permissions on your machine to install theseprerequisites. (You can verify that you have these permissions in SystemPreferences -> Users & Groups.)
See 1.1 Install Xcode and Xcode command line tools and 1.2Get the local macOS SDK for more information on how toinstall these prerequisites.
Getting the source
Firstly you need to prepare a directory and get the bootstrap scriptthat will do the rest:
If you don't have Python 3.6 or later or Mercurial installed, see 2.1a Installdependencies via Homebrew for more information on howto do so. Then in your terminal from above start the bootstrapper like this:
… and follow the prompts. This will use mercurial to checkout thesource code. If you prefer to work with git, use this command instead:
If you don't have Homebrew orPorts installed - software packagemanagers that will let us install some programs we'll need - you'll beasked to pick one. Either will work, but most Mozilla developers useHomebrew.
If you don't let the bootstrap.py
script clone the source for youmake sure you do it manually afterward before moving onto the next step.
Build Firefox!
Now we tie it all together.
In your terminal window, cd
to your Mozilla source directory chosenbefore and type:
The ./machbootstrap
step is a catch-all for any dependencies notcovered in this documentation. If you are working on Firefox frontendsor building Firefox without any changes, select Artifact Builds inthe first question in ./machbootstrap
. Artifact builds willcomplete more quickly! Artifact builds are unsuitable for those workingon C++ code.
You're on your way. Don't be discouraged if this takes a while; it takessome time even on the fastest modern machines and as much as two hoursor more on older hardware. Firefox is pretty big, because the Web isbig.
Now the Fun Starts
You have the code, you've compiled Firefox. Fire it up with./machrun
and you're ready to start hacking.
Build steps (details)¶
Building on macOS is divided into the following steps:
Firefox For Mac Os X
Install Apple-distributed developer tools - Xcode, Xcode cli toolsand macOS SDK locally
Install supplementary build tools
Obtain a copy of the Mozilla source code
Configure the Mozilla source tree to suit your needs
Build Firefox
1.1 Install Xcode and Xcode command line tools¶
You first need to install Xcode, for which you have two options but bothrequire you to sign in with an Apple ID:
From Apple Developer Download page - directlink. Install thelatest release (non-beta) version of Xcode, open
Xcode.xip
,and then beforerunning the extracted Xcode.app, move it fromthe download folder to /Applications. (Running it from anotherlocation may screw up various build paths, homebrew builds, etc. Fixby runningsudoxcode-select-switch/Applications/Xcode.app
)From the Mac App Store - directlink.
Open /Applications/Xcode.app and let it do its initial first run andsetup stuff.
Install the Xcode command line tools byrunning xcode-select--install
in your terminal.
1.2 Get the local macOS SDK¶
Firefox currently requires a local copy of macOS 10.11 SDK to build (allyour other apps will still use your more recent version of this SDK,most probably matching your macOS version).
There are various issues when building the Mozilla source code withother SDKs and that's why we recommend this specific version.
To get the 10.11 SDK, first download Xcode 7.3.1 from the MoreDownloads for AppleDevelopers page. Oncedownloaded, mount the .dmg file. Then in the Terminal run the following:
2. Install supplementary build tools¶
Mozilla's source tree requires a number of third-party tools andapplications to build it. You will need to install these before you canbuild anything.
You have the choice of how to install all these components. You can usea 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 describehow to install the packages using existing package managers. Choosewhatever package manager you prefer.
2.1a Install dependencies via Homebrew¶
Homebrew is 'the missing package manager formacOS.' It provides a simple command-line interface to install packages,typically by compiling them from source.
The first step is to install Homebrew. See https://brew.sh/
Once you have Homebrew installed, you'll need to run the following:
Python 2 is never necessary solely to build Firefox, but it is still requiredfor some development tasks (including testing and pushing to try
). If yoursystem does not already have a Python 2 installed, you can use brew
toinstall one:
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 installpage, download the .dmg foryour platform, and install it. If you already have MacPorts installed,ensure it is up to date by running:
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 youraccount in System Preferences.port
command not found: add it to your path (see thetroubleshooting section below).
Use MacPorts to install the packages needed for building Firefox:
You'll then see lots of output as MacPorts builds and installs thesepackages and their dependencies – it takes a while, so go grab a cup ofcoffee.
Note: By default, this will install Python 2.7, which in turn willpull in all of the X11 libraries, which may take a while to build. Youdon't need any of those to build Firefox; you may want to consideradding +no_tkinter to the install line to build a python withoutsupport for the X11 UI packages. This should result in a much fasterinstall.
Note: With older versions of Xcode (eg 6.4) you may need to useMacPorts 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 useMercurial to interact with these repositories. There are many ways toinstall Mercurial on macOS:
Install official builds fromSelenic
Install via Homebrew:
Install via MacPorts:
Install via Pip:
Once you have installed Mercurial, test it by running:
If this works, congratulations! You'll want to configure your Mercurialsettings to match other developers. See Getting Mozilla Source CodeUsing Mercurial.
If this fails with the error 'ValueError:unknownlocale:UTF-8
',then see theworkaroundson the Mercurial wiki's Unix Install page.
Download Firefox Mozilla For Mac Os X
When trying to clone a repository you may get an HTTP 500 error(internal server error). This seems to be due to something that MacMercurial sends to the server (it's been observed both with MacPort andselenic.com Mercurial binaries). Try restarting your shell, yourcomputer, or reinstall Mercurial (in that order), then report back herewhat worked, please.
3. Obtain a copy of the Mozilla source code¶
Best external ssd drive for macbook pro. You may want to read Getting Mozilla Source CodeUsing Mercurial for thecomplete instructions.
If you are interested in Firefox development only then run the followingcommand, which will create a new directory, mozilla-central
, in thecurrent one with the contents of the remote repository.
Below command will take many minutes to run, as it will be copying acouple hundred megabytes of data over the internet.
(If you are building Firefox for Android, you should now return to theAndroid build instructions.)
4. Configure the build options¶
In your checked out source tree create a new file, mozconfig
, whichwill contain your build options. For more on this file, see Configuring Build Options.
To get started quickly, create the file with the following contents:
Firefox no longer builds with gcc 4.8 or earlier, but the build systemshould automatically select clang if it is available in the PATH. Ifthat is not the case, you need to set CC and CXX. For instance, if youinstalled Clang 9 via Homebrew, then you need to have this in yourmozconfig
:
5. Build¶
Firefox Mozilla For Mac Os X
Note: By default, this will install Python 2.7, which in turn willpull in all of the X11 libraries, which may take a while to build. Youdon't need any of those to build Firefox; you may want to consideradding +no_tkinter to the install line to build a python withoutsupport for the X11 UI packages. This should result in a much fasterinstall.
Note: With older versions of Xcode (eg 6.4) you may need to useMacPorts 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 useMercurial to interact with these repositories. There are many ways toinstall Mercurial on macOS:
Install official builds fromSelenic
Install via Homebrew:
Install via MacPorts:
Install via Pip:
Once you have installed Mercurial, test it by running:
If this works, congratulations! You'll want to configure your Mercurialsettings to match other developers. See Getting Mozilla Source CodeUsing Mercurial.
If this fails with the error 'ValueError:unknownlocale:UTF-8
',then see theworkaroundson the Mercurial wiki's Unix Install page.
Download Firefox Mozilla For Mac Os X
When trying to clone a repository you may get an HTTP 500 error(internal server error). This seems to be due to something that MacMercurial sends to the server (it's been observed both with MacPort andselenic.com Mercurial binaries). Try restarting your shell, yourcomputer, or reinstall Mercurial (in that order), then report back herewhat worked, please.
3. Obtain a copy of the Mozilla source code¶
Best external ssd drive for macbook pro. You may want to read Getting Mozilla Source CodeUsing Mercurial for thecomplete instructions.
If you are interested in Firefox development only then run the followingcommand, which will create a new directory, mozilla-central
, in thecurrent one with the contents of the remote repository.
Below command will take many minutes to run, as it will be copying acouple hundred megabytes of data over the internet.
(If you are building Firefox for Android, you should now return to theAndroid build instructions.)
4. Configure the build options¶
In your checked out source tree create a new file, mozconfig
, whichwill contain your build options. For more on this file, see Configuring Build Options.
To get started quickly, create the file with the following contents:
Firefox no longer builds with gcc 4.8 or earlier, but the build systemshould automatically select clang if it is available in the PATH. Ifthat is not the case, you need to set CC and CXX. For instance, if youinstalled Clang 9 via Homebrew, then you need to have this in yourmozconfig
:
5. Build¶
Firefox Mozilla For Mac Os X
Once you have your mozconfig
file in place, you should be able tobuild!
If the build step works, you should be able to find the builtapplication inside obj-ff-dbg/dist/
. If building the browser with--enable-debug
, the name of the application is NightlyDebug.app
.To launch the application, try running the following:
Note: The compiled application may also be named after the branchyou're building; for example, if you changed these instructions to fetchthe mozilla-1.9.2
branch, the application will be namedNamoroka.app
or NamorokaDebug.app
.
Hardware requirements¶
There are no specific hardware requirements, provided that the hardwareaccommodates all of the software requiredto build Firefox. Firefox can take a long time to build, so more CPU,more RAM and lots of fast disk space are always recommended.
Processor: Intel CPUs are required. Building for PowerPC chips isnot supported.
Memory: 2GB RAM minimum, 8GB recommended.
Disk Space: At least 30GB of free disk space.
Software requirements¶
Operating System: macOS 10.11 or later. It is advisable toupgrade to the latest 'point' release by running Software Update,found in the Apple menu. You will need administrative privileges toset up your development environment
Development Environment: Xcode. You can obtain this from the AppStore.
Package Management: Either Homebrew orMacPorts.
These options are specific to Mozilla builds for macOS. For a moregeneral overview of build options and the mozconfig
file, seeConfiguring Build Options.
Compiler: Firefox releases are no longer built with gcc-4.8 orearlier. A recent copy of clang is needed.
There are some options on where to get clang:
Newer versions of Xcode.
Following the instructions in the clangwebsite forinformation 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 configureshould use it.
The following options, specified with ac_add_options
, are lines thatare intended to be added to your mozconfig
file.
macOS SDK: This selects the version of the system headers andlibraries to build against, ensuring that the product you build willbe able to run on older systems with less complete APIs available.Selecting an SDK with this option overrides the default headers andlibraries in
/usr/include
,/usr/lib
, and/System/Library
.Official trunk builds use MacOSX10.11.sdk. Checkbuild/macosx/universal/mozconfig.commonfor the SDK version used for official builds of any particular sourcerelease.
Applications built against a particular SDK will usually run onearlier versions of macOS as long as they are careful not to usefeatures or frameworks only available on later versions. Note thatsome frameworks (notably AppKit) behave differently at runtimedepending on which SDK was used at build time. This may be the sourceof bugs that only appear on certain platforms or in certain builds.
For macOS builds, defines are set up as follows:
XP_MACOSX
is definedXP_UNIX
is definedXP_MAC
is not defined.XP_MAC
is obsolete and has beenremoved from the source tree (see {{ Bug(281889) }}). It was used forCFM (non-Mach-O) builds for the classic (pre-X) Mac OS.
This requires care when writing code for Unix platforms that excludeMac:
Troubleshooting¶
If configure (or generally building with clang) fails with``fatal error: ‘stdio.h' file not found``: Make sure the Xcodecommand line tools are installed by running.
xcode-select--install
.For inexplicable errors in the configure phase: Review allmodifications of your PATH in .bash_profile, .bash_rc or whateverconfiguration file you're using for your chosen shell. Removing allmodifications and then re-adding them one-by-one can narrow downproblems.