Compiling a web browser is not a task programmers typically think of doing unless they are writing changes to it and directly involved in the development of the browser. However, compiling a web browser can be a very educational and interesting experience in what technologies, processes, and code base size is involved in compiling browser builds.
In this case, I will be compiling Firefox on OSX 10.10 (Yosemite) and documenting my process as well as the resources I used to achieve it the compilation.
Typically wget is used to retrieve the development environment. However, with the introduction of OSX 10.10 wget was removed in favour of curl so it needs to be installed.
Therefore, the first step is to install wget by installing the Xcode command line tools. These tools are important for any developer using OSX and you may already have them installed try typing
$ wget into terminal. If it is not yet installed, you will need Xcode which requires a developer account to download. In my case, I already had Xcode installed so I installed the command line tools via terminal with
$ xcode-select --install.
Once the build environment is downloaded and installed, I downloaded the Firefox git repository. This repo has over a million objects and takes some time to download. I prefer using git, so I download it with
$ git clone https://git.mozilla.org/integration/gecko-dev.git. This repo is called “gecko-dev” because the engine Firefox uses is the gecko engine originally used by Netscape.
Once downloaded, using terminal I navigated to the location I cloned the repository to. From this point, mach is used to build Firefox. This process can take several hours. In my case on a 2009 Macbook Pro 2.66GHz/8GB took approximately two hours to build.
To build Firefox, run
$ ./mach build
Once built, I received the below message. To run the build, the command
./mach run opened the nightly build.
This process, although not complex, highlighted the enormity of Firefox’s repository and build processes. Gecko has existed since 1997 and has a big community of contributors who are constantly adding code and tweaking existing code. These additions mean Firefox is only growing larger and while it uses the Gecko engine, the compilation process will only grow more complex.