With the release of Snow Leopard, Apple is really starting to push 64-bit programs. Firefox is working towards a 64-bit release but even though the bugs are all resolved, it won’t be shipping anytime soon. Here’s what I did to build a 64-bit LLVM version of Firefox. Important warnings follow the list!
I had MacPorts already installed so I won’t go too much into that. Basically, install the Developer Tools that come on your OS X install disc, and then install MacPorts.
- Install a couple of ports we’ll need to get the code and build it:
sudo port install autoconf213 mercurial libidl
- Pull the mozilla-central code. This is the “trunk,” the centre of the development effort. As such, it changes many times a day as bugs are fixed and code is checked in. Despite this, it’s usually pretty stable; automated testing procedures allow developers to roll back any code checkins that cause a problem, although this doesn’t happen for 64-bit builds. Save the code wherever you want to, it’s about 700 MB or so.
hg clone http://hg.mozilla.org/mozilla-central/ /Users/you/wherever
Other repositories include the Gecko 1.91 branch, from which Firefox 3.5.x is built, at http://hg.mozilla.org/releases/mozilla-1.9.1/ or the Gecko 1.92 branch, which will eventually become Firefox 3.6, at http://hg.mozilla.org/releases/mozilla-1.9.2/. However, neither of these branches have the required fixes for a 64-bit build, which is why we’re working with the trunk.
- Create a
.mozconfig
file. This file contains instructions specific to your build, and is where we’re going to be making the 64-bit stuff happen. It must be saved in your home directory, e.g./Users/you/
and can be called either.mozconfig
ormozconfig
. The latter will show up in Finder windows. Use your favourite text editor here, I’m not cool enough to use vi or emacs.nano ~/.mozconfig
- Here are the instructions for our 64-bit, LLVM, Snow Leopard-only build.
. $topsrcdir/browser/config/mozconfig mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-ff-dbg mk_add_options MOZ_MAKE_FLAGS="-s -j4" mk_add_options MOZ_CO_PROJECT=browser ac_add_options --enable-optimize ac_add_options --enable-application=browser ac_add_options --enable-official-branding ac_add_options --disable-debug ac_add_options --disable-tests ac_add_options --disable-installer ac_add_options --target=x86_64-apple-darwin10.0.0 ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.6.sdk ac_add_options --enable-macos-target=10.6 CC="llvm-gcc-4.2 -arch x86_64" HOST_CC="llvm-gcc-4.2" CFLAGS=-Qunused-arguments CXX="llvm-g++-4.2 -arch x86_64" HOST_CXX="llvm-g++-4.2" CPPFLAGS=-Qunused-arguments RANLIB=ranlib AR=ar AS=$CC LD=ld STRIP="strip -x -S"
- And we’re ready to build. I always pull the latest version of the code just before I build. Again, this command is run from the source directory you created earlier:
hg pull -u; make -f client.mk build
Go get a coffee; on my 2 GHz MacBook it takes about 25 minutes.
- That’s it. To run the new product, you can dig it up in the Finder, or run it from Terminal with this command.
open obj-ff-dbg/dist/Firefox.app --args -profilemanager
This process is not without its caveats. Some things you should note:
- I suggest creating a separate profile for running trunk builds, which is why the
open
command above runs the profile manager. For the most part you won’t have any problems, but better to be safe than sorry. - Unless you can find some 64-bit plugins, you have no Flash, no Quicktime, no Java, etc. Also, some addons that ship with pre-compiled binary code (e.g. Weave) will not work.
- By building with the
--enable-official-branding
option, you avoid some of the annoyances of running a development build – the browser identifies itself as Firefox, rather than Minefield. But you must not, under any circumstances, redistribute the program. If you are going to redistribute the program in any way, remove that option from your.mozconfig
file. Even if you’re giving a single copy to a friend. - The application you just created will only work in Snow Leopard, probably only on a Core 2 Duo processor or better.
This is crazy 🙂 You officially converted me into a Firefox MacOS builder addict now 🙂 I’m eager to see them split the trunk into a new release now.
Any speed comparisons vs say the FF3.6b1 just released?
It does seem faster, but maybe because there are no plugins!