HOWTO: Compile Sunbird 0.7 on an Intel Mac in an hour

(Donated to Mozilla Wiki on 05 Jan 08)

Written on 26 Nov 07 and last updated on 27 Nov 07.

Specs: MacBook Pro, 2.2Ghz, 2GB ram, 8600M GT 128MB, Mac OS X 10.4.11

Purpose: This guide is meant to serve as a quickstart on compiling Sunbird 0.7 for the Intel Mac, in under an hour. It is not intended to be comprehensive.

Why Sunbird: Sunbird is an application that can be compiled in under half an hour on my machine. (Firefox definitely takes much longer)

Documentation used: Build documentation, Mac OS X Build Prerequisites, Configuring build options, Build and install

1. Install the prerequisites (20 – 25 minutes, your mileage may vary)

Xcode 2.4.1 came with my Tiger restore DVD, and I installed it with the default options. (ten minutes)

Having a choice of Fink and MacPorts, I went with MacPorts. You can download it here. Installing MacPorts is as simple as running the installer found in the mounted .dmg. (five minutes)

Next, I used MacPorts to install libIDL (which also installs GLib): [note: ignore the "$", it’s meant to represent a set of commands to be executed]

$ sudo port sync
$ sudo port install libidl

(You would need to have your administrative password ready; takes around five to ten minutes, depending on your internet connection)

2. Download the source (5 minutes; depends on your internet connection)

I chose not (yet) to plunge into CVS and instead downloaded the 0.7 source directly.

I created a folder on my desktop called "Test" (or whatever you want to call it), dragged the .tar.bz2 file inside and ran this command from that folder "Test" in Terminal:

$ tar xjfv lightning-sunbird-0.7-source.tar.bz2

There will be an extracted "mozilla" folder inside.

3. Configure build options (5 minutes)

In the mozilla folder, I ran

$ echo "# My first mozilla config" > .mozconfig

in Terminal. This creates a .mozconfig file with the comment "My first mozilla config".

I skipped all the Objdir stuff as I am only compiling Sunbird, and entered the .mozconfig below: (the ones with # are comments)

# My first mozilla config
# v0.1 alpha test

. $topsrcdir/calendar/sunbird/config/mozconfig
ac_add_options –enable-optimize
ac_add_options –disable-static –enable-shared
ac_add_options –disable-debug
ac_add_options –with-macos-sdk=/Developer/SDKs/MacOSX10.4u.sdk
ac_add_options –disable-tests

No debugging, no static build, no auxillary tests needed, optimized and Intel-only build configuration. For a more comprehensive documentation on all the switches and options in .mozconfig, please refer to the Mozilla Developer Center.

4. Build the source (25 minutes)

Having done up everything, I proceeded to compile the source by this Terminal input in the same location as .mozconfig:

$ make -f build

It took just under half an hour for my hardware configuration. Your mileage may vary though. I had no build problems.

5. Run your program!

The compiled (for Intel Mac only; not a universal binary) after completion appears in /mozilla/dist/. It takes up 7.4MB.

Here’s a screenshot immediately after double-clicking the app in Finder, canceling the import wizard, enlarging the interface window and clicking on "About".


Due to trademark issues, there is a switch that must be input in .mozconfig to make it compile with official branding. For my case, it didn’t matter to me, as I have just compiled my first application on the Mac. (Gentoo Linux experience a few years back was a good help too.)

Endnotes: I hope this guide serves as a decent beginner’s guide to building Sunbird. It should be noted that any build questions should go to #calendar or #developers on, where there are lots of other experienced people who are more than willing to answer any of your queries (Please ask nicely). Do read the Mozilla documentation as well.