How can I build Firefox Browser on macOS?

Before starting this work, I have a good inspiration story. Dr. Mohammad Zahidur Rahman had been taken our Software Engineering course. He always expressed a demand that his student will start working with large scale open source software build and trying to edit those. From that time, I have a wish to do this kind of work. Although course has been finished but I have no time to work! By this way, I passed about 5 months. In the time, I was so busy with my MozFest, 2018 — London cause I was selected a facilitator on that conference. For visa complexity, I couldn’t participate. So It’s huge time to do this work. So I just seat to start.

At first, I didn’t know that this process is called build. Normally we work with C/C++ and we call it as compiling. After doing some searching I got that there has an article at developer.mozilla.org as Building Firefox for macOS. Oh Great! Started! But very beginning I got a great error. Cause I just cloned from Mercurial and started building! Ooopps!

Then again started researching. I knocked again and again to Mak who is the community leader of Mozilla Bangladesh. At last, he gave me suggestion to knock build engineer of Mozilla. Also suggested to use IRC. In our last l10n workshop at Kolkata, he showed me how to use IRC. By the way I’m a NDA signed volunteer and reps of Mozilla. So I easily got build engineer email. I started mailing and got some response. They suggested me to contact through IRC.

And in the meantime, I got some important instruction from them. As starter, they said that you did not install Homebrew. Now It’s time to play. On Building Firefox for macOS I noticed that there has a line One-Line Setup (Try This First!). Homebrew is a package manager of macOS. By the way MacPorts is also okay. It’s also a package manager. I installed twice and made a error again.

Now at IRC one suggested me to uninstalled MacPorts. Okay. I uninstalled it. Now I was going to ahead.
1. xcode is installed before on my pc so need nor.
2.1. Install supplementary build tools: Homebrew installed.
brew install yasm mercurial gawk ccache python

Then installedbrew install autoconf@2.13 autoconf is a scripts configure tool.

2.2 Install Mercurial: Now It’s time to install Mercurial.
brew install mercurial(Homebrew using so this one)
To check hg version wrote. If all are okay then will show version.

3. Obtain a copy of the Mozilla source code: Now It’s time to clone Mozilla source code from Mercurial. Your need to go any folder then
$ hg clone https://hg.mozilla.org/mozilla-central/ Mozilla-central
This will take some time. Then
$ cd Mozilla-central
Mean we entered in a folder.

4. Configure the Mozilla source tree for build options: Mean at source tree, we shall open a new file as .mozconfig . I opened it at terminal by command linetouch .mozconfig

Now we will open it as text mode.
open -e .mozconfig

This two commands have not in developer.mozilla.org. I learned it by searching. Now we will write on that file:
# 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
ac_add_options --with-macos-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk

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

We need to tell that Still Mozilla use MacOSX10.11.sdk . So you have to go at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs and need open it.So open Terminal and write
open /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/

Within a twinkling, there will open a folder. Now need to keep MacOSX10.11.sdk . You will download it from https://github.com/phracker/MacOSX-SDKs . Keep just after unzipping.

If you don’t do it, you will get a black screen after a successful build.

Now save that code at .mozconfig . Now chill some moments. You did a great work.

5. Build: It’s the main work.
./mach bootstrap

Write at terminal. Then it will give you to follow some instruction. Your need to follow all by common sense. Then write

./mach build

It will take a lots of time. It’s about 1 hour. If all are okay then you will get that “Your build was successful!”. Now need to give a Lungi Dance ;)

Now It’s time to write.
./mach run.

Ooooppps You have done it!

Oh Man wait! You may get a lots of errors. |mach run| isn’t each to get.

Wait! I need to show off!
https://paste.ubuntu.com/p/fGY2qRhqpQ/ It’s only 46 lines! No man! I built it 3–4 times so it’s 46 only. Many files were pre built.

It’s that one
There will be produced these file under obj-ff-dbg

If you get error, so what will you do?
https://wiki.mozilla.org/IRC This is Mozilla IRC wiki. Follow instruction. Join at #introduction. You can also join at #firefox. But for Building you will get solution at #introduction. You will get many Firefox Engineer who are waiting to help you.

I got these errors.
https://bugzilla.mozilla.org/show_bug.cgi?id=1494022
https://bugzilla.mozilla.org/show_bug.cgi?id=1493330
https://bugzilla.mozilla.org/show_bug.cgi?id=1446946
https://bugzilla.mozilla.org/show_bug.cgi?id=1306395
https://bugzilla.mozilla.org/show_bug.cgi?id=1342292

Don’t frustrated. You can get any error, just paste it at Google.

Thanks everyone who helped me to do this work. Specially, my course teacher Dr. Mohammad Zahidur Rahman, Mozilla Bangladesh community leader Mahay Alam Khan and Belayet Hossain. And A big hats off to Mozilla Engineer ( I can’t say their name cause I’m a NDA signed volunteer.)

If you successfully do it, don’t forget to inform me.

Graduate Research Assistant at UTRGV, USA and Freelance Email Signature Developer