If you’re not using Arch, you will need to do the same patch command mentioned below, but should follow the general Firefox build instructions instead (they seem pretty straightforward). Ignore the first section here (titled getting the build script), and apply the patch right after you cd mozilla-central.

If you are using Arch, the process is just a trivial modification to the Firefox AUR package PKGBUILD.

This document is split into four parts:

  • Getting the Firefox build script

    • This is for Arch Linux only

  • Preparing the patch

  • Building Firefox

  • Building Firefox Nightly

I did this process a couple of times, and the total compile time took anywhere from 15-65 minutes. My computer has a Ryzen 7 3800x (8x 3.9-4.5 GHz), a NVMe SSD, and 32 GB of DDR4-3200 RAM. After the build was complete, all the files totaled to just under 12 GB. So if you have 32+ GB of RAM, you might be able to get a decent speedup by doing it in tmpfs (my SSD is PCIe 4.0 5 gbit/s so probably not as huge of a speedup to my 15-65 minutes as if you have a spinning hard drive or SATA SSD).

Getting the Firefox build script (Arch only)

You’ve probably compiled an AUR package before. If you want to build, for example, the micro text editor, you run:

  • git clone https://aur.archlinux.org/micro.git will download a folder with the PKGBUILD, as well as any additional Arch-specific files/patches.

  • makepkg -s will execute the instructions specified in the PKGBUILD and create a file named something like micro.pkg.tar.

  • pacman -U micro.pkg.tar will install the created package.

A popular package like Firefox could be distributed via the AUR, but it would be inconvenient for every user to download the source code and build it every time Firefox was updated. So instead an Arch Linux maintainer does this exact same build proces every time Firefox is updated, and uploads the created firefox.pkg.tar.xz file to the Arch repositories, from where you download and install it. What’s important to note is that every 'official' Arch package in the repositories is just a precompiled AUR package.

So the first step is to get the PKGBUILD for Firefox. From there, we will make a very simple modification to the PKGBUILD to have it apply our patch, and then run makepkg -s and pacman -U firefox.pkg.tar to build and install the patched Firefox.

We can do this with asp checkout firefox (install asp through Pacman) [1]. Like the git clone step for AUR packages, this will download a firefox folder with a PKGBUILD and a few other files. The firefox folder will contain a trunk folder and a repos/extra-x86_64 folder; they were both identcal for me and I just used trunk.

Getting the patch

The revision we want to revert is this. On the right siderbar or under the 'Actions' menu there is a 'Download Raw Diff' button to get the actual diff file.

  • Edit: I have also added this to my list of highly annoying revisions. However, I was not able to successfully revert this patch after a bit of trying; the code for this section of the browser has apparently changed too much for the patch to be easily revertable.

If you scroll down in Phabricator to the 'Revision Contents' section you can see this revision edits a number of files. In the same order as on Phabricator:

  • first, four code files - the changes in these files remove the clickSelectsAll and doubleClickSelectsAll options

  • then, four test files - these files were for testing that the options worked

  • and finally, the file modules/libpref/init/all.js

We want to revert the entire revision to get back the options, but I found that if the changes to the tests were reverted then Firefox failed to build. So I edited the raw diff file and removed everything past line 140. At this point the diff file had 140 lines, ending in:

   // Whether telemetry events should be recorded.
   ["eventTelemetry.enabled", false],
 (there is a single space on this line)

This leaves in the diff just the changes to the first four files - we won’t revert the changes to the test files, or the changes to modules/libpref/init/all.js. Deleting modules/libpref/init/all.js from the diff was an oversight on my part, but it doesn’t seem to matter - the built Firefox works as expected. It seems the file has something to do with creating the default config, so if you do have an issue you can probably just go to about:config and add a new browser.urlbar.clickSelectsAll preference yourself (but I didn’t have any issues, even when creating a new profile with the patched browser - but I also had these prefs set via user.js, so you might need to manually create the prefs in about:config).

You can save this patch in the same folder as the PKGBUILD (or, if not on Arch, in the directory that contains ( / will contain) the mozilla-central folder - on Arch the PKGBUILD copies these patch files into the right place).

The downloaded AUR folder already contained an Arch-specific patch file named 0001-Use-remoting-name-for-GDK-application-names.patch, so I named this one 0002-fix-urlbar-regression.patch. But the name doesn’t matter at all, you can name it anything.

  • Edit: Phabricator seems to have changed the file extension for patches from .patch to .diff. It doesn’t matter, the name of the patch file is irrelevant. Name it whatever you want.

Applying the patch

If not using Arch, you cd into the mozilla-central folder and do:

$ patch -RNp1 -i ../0002-fix-urlbar-regression.patch

The command will revert the diff, bringing back the single click setting. This step is the only extra thing you need to do; aside from creating and applying the patch file you can just follow Mozilla’s instructions and build as you would normally do on your OS. Again, do this right after cloning mozilla-central.

If you are using Arch, we just modify the PKGBUILD to include this step. The PKGBUILD has a list of source files and checksums, so we first add the patch file to it (in this case to the end of both lists):



There’s no need to put the actual sha256sum since we manually created the patch file and added it to the build - this isn’t some random file we’re downloading from the internet which needs to be verified. Thus we just use 'SKIP'.

The script is already applying its own 0001-…​ patch, so I just added our patch command right after it. The -R is because we are reverting this patch.

prepare() {
  mkdir mozbuild
  cd firefox-$pkgver

  # https://bugzilla.mozilla.org/show_bug.cgi?id=1530052
  patch -Np1 -i ../0001-Use-remoting-name-for-GDK-application-names.patch

  patch -RNp1 -i ../0002-fix-urlbar-regression.patch

  echo -n "$_google_api_key" >google-api-key
  echo -n "$_mozilla_api_key" >mozilla-api-key

At this point you makepkg -s, and then pacman -U the built package.

If for you need to rebuild the project, I found that rm -rf src pkg mozilla-central may prevent build errors. Probably worth trying without deleting first, since if you delete it you’ll need to redownload all the Firefox sources.

Building Firefox Nightly

Probably the reason you would want to do this is to allow for installing unsigned add-ons (which is disabled in the official releases). There exists an 'unbranded' Firefox which is idental to normal FF but without the branding and with unsigned extensions enabled. However, I wasn’t able to find any documentation from Mozilla on how to compile your own unbranded build. The normal Firefox PKGBUILD has a number of flags (search the PKGBUILD for 'brand' and 'sign', case insensitive) related to branding but I’m not sure which ones are relevant to enabling unsigned add-ons. Anyway, Nightly gets all the cool features first and is still quite stable.

For Nightly, download the firefox-nightly-hg AUR package. The next few steps are the same as for normal Firefox: add the patch file to the PKGBUILD folder; in the PKGBUILD add the patch file to the list of sources; and tell the PKGBUILD to SKIP the checksum checking for the patch file.

git clone https://aur.archlinux.org/firefox-nightly-hg.git

Add the new patch command to prepare() in the same place as with the normal Firefox PKGBUILD:

prepare() {
  mkdir -p mozbuild
  cd mozilla-central

  # https://bugzilla.mozilla.org/show_bug.cgi?id=1530052
  patch -Np1 -i ../0001-Use-remoting-name-for-GDK-application-names.patch

  patch -RNp1 -i ../0002-fix-urlbar-regression.patch       <-- THIS LINE WAS ADDED

  echo -n "$_google_api_key" >google-api-key
  echo -n "$_mozilla_api_key" >mozilla-api-key

If you have any extra patches to apply you can add them here - the -R flag reverts a patch file, otherwise to apply a patch you can just use -Np1 -i ../filename

If you build it like this, the browser still won’t let you add unsigned add-ons. Instead you have to delete the line export MOZ_REQUIRE_SIGNING=1 from the PKGBUILD. For me that was sufficient to enable unsigned add-ons.

Here is a summary of all the PKGBUILD changes:

  • Add patch file to sources (same as normal Firefox package)

  • Add patch file checksum / 'SKIP' (same as normal Firefox package)

  • Add patch command to prepare() (same as normal Firefox package)


You can makepkg -s and pacman -U and you’re done.

1. https://wiki.archlinux.org/index.php/Arch_Build_System#Retrieve_PKGBUILD_source