How to build Haiku on Mac OS X

Article contributed by VinDuv on Sat, 2008-10-11 16:49
2010-January: This document is now obsolete. We are in the process of consolidating and re-organizing the website documentation. For now please refer to the in-progress website documentation.

Even if Mac OS X is Unix based, building Haiku on it still requires some tweaks.
I tested these instructions on Mac OS X 10.5.6 (Leopard). If they work on older versions (Tiger, Panther…) please let me know.

  1. Case-sensitive disk image
  2. Fetching the buildtools and the Haiku source code
  3. Install required software
  4. Let’s Patch
  5. Building the buildtools ;-)
  6. Building Haiku


  • At least 3 GB of free space on your hard drive
  • You will need the Xcode Tools: use the installer on your Mac OS X Install DVD, or download the latest version from Apple Developer Connection (free registration required).
  • You must be logged in as administrator to install some tools.
  • MacPorts will also be required (see Step 3 for installation tips)

Step 1: Case-sensitive disk image

The Mac OS file system, HFS+, is case-insensitive by default. This causes troubles during the build of some Haiku components, because of wrong headers inclusion (“String.h” (from Haiku) instead of “string.h” (from the system) for instance).
If your Mac OS X partition is not in case-sensitive HFS+ (which is very likely), you need to create a case-sensitive disk image and put Haiku buildtools and source code on it.

1) Open Disk Utility (in /Application/Utilities)
2) Click “New Image”, and enter the following parameters:

  • Volume name: You should enter a short name without special character or spaces.
  • Volume size: Haiku sources, compiled objects and the resulting Haiku disk image will take around 2.7 GB, but you should put more (8 GB for instance), especially if you want to add optional packages to the image. Only the consumed space on the image will be used on your hard drive, so don’t be afraid of setting a big value ;-)
  • Volume format: Mac OS Extended (Case-sensitive)
  • Encryption: You should say “none”, unless you really want to slow down Haiku building…
  • Partitions: (Tiger users will not have this - just skip it): Choose No partition map.
  • Image format: Choose “sparse disk image”.

Disk utility settings panel
The image is automatically mounted on the Desktop. If you want to remount it later, just double-click on the image file.

Step 2: Fetching the buildtools and the Haiku source code

Open a Terminal (in /Application/Utilities), and enter:

cd /Volumes/Haiku/

“/Volumes/Haiku” refers here (and in all this tutorial) to the mounted disk image name. I named it “Haiku”, so if you chose another name, use it instead of “Haiku” after “/Volumes/”.

Checkout the buildtools:

svn checkout svn://svn.berlios.de/haiku/buildtools/trunk buildtools

[ Note to Tiger users: IIRC, Subversion is not available with Xcode 2.5. You have to install it manually. ]
And the sourcecode:

svn checkout svn://svn.berlios.de/haiku/haiku/trunk haiku

You should now have two folders “haiku” and “buildtools” into the mounted disk image.

Step 3: Install required software

First, install MacPorts (A standard Installer package is provided)
Close your Terminal, and enter in a new one:

sudo port install gnuregex gawk yasm

(You will be prompted for the administrator password of the current account - Do not worry if nothing you type shows after the Password prompt, this is intended ;-) )

  • If you plan to use optional packages, add wget to the list.
  • If you plan to build a bootable Haiku CD, add cdrtools to the list.
If you get an error “port: command not found”, the MacPorts shell configuration, stored in ~/.profile, is probably not taken into account.
If you’re using Bash, you probably have a ~/.bash_profile or ~/.bash_login file, preventing bash to read ~/.profile.
Check the file used by Bash (in the mentioned order) and add these lines to the used file:

export PATH=/opt/local/bin:$PATH
export MANPATH=$MANPATH:/opt/local/share/man
export INFOPATH=$INFOPATH:/opt/local/share/info

If you are using another shell, take a look a the shell documentation to see which file is parsed at login, and add the required commands.
You can now retry the port install... command in a new Terminal.

After MacPorts finished installing the tools, install the modified Haiku jam:

cd /Volumes/Haiku/buildtools/jam
sudo ./jam0 install
[Enter your password]
cd ..

Reopen a new Terminal, and enter jam -v.
You should get:

Jam 2.5-haiku-20080327. OS=MACOSX. Copyright 1993-2002 Christopher Seiwald.

Step 4: Let’s Patch

The patch file is now on Trac, so all you have to do is to launch:

cd /Volumes/Haiku
curl -O http://dev.haiku-os.org/raw-attachment/ticket/3298/haiku_gcc2_osx_2.patch
patch -p0 < haiku_gcc2_osx_2.patch

Step 5: Building the buildtools ;-)

Now, you can compile GCC2 with:

cd /Volumes/Haiku/haiku
./configure --build-cross-tools ../buildtools

If you want to build Haiku with GCC4, use:

./configure --build-cross-tools-gcc4 x86 ../buildtools/

If you do not know which one you should use, choose gcc2: Original BeOS R5 binaries (and many Haiku optional packages) will not run on a gcc4 build.

./configure has some more options: use ./configure --help to list them.

After some time, you should get:

binutils and gcc for cross compilation have been built successfully!

Step 6: Building Haiku

Installing to the hard drive

You can boot Haiku (with some mitiged success in my case :-/) on your Mac. Before installing, please consider the following points :

  • Only do this if you feel confident. There are serious risks of data loss here.
  • You need a Mac with an Intel processor.
  • Haiku must be installed to an internal hard drive. USB or FireWire external drives will not work.
  • You need to create a new partition on your hard drive. The Boot Camp Assistant or Leopard’s Disk Utility may help.

The first step is to determine the name of the partition where Haiku should be installed. Mac OS X uses the following naming scheme : diskXsY, where X is the disk number (starting with 0), and Y the partition number (starting with 1).
You can use the diskutil list command to get the list of disks attached to the computer, and their partitions.
Create or edit the file [Mounted Disk Image]/haiku/build/jam/UserBuildConfig, and add the following line :

DefineBuildProfile disk : disk : "/dev/diskXsY" ;

(with X and Y replaced by the actual partition numbers)
This will create a “build profile” rule that will install Haiku to the partition. For more information about build profiles, see the file [Mounted Disk Image]/haiku/build/jam/UserBuildConfig.ReadMe.
After this, start a Terminal, double check the disk and partition numbers and run :

cd /Volumes/Haiku/haiku
sudo chmod o+r /dev/diskX
[enter your password]
sudo chmod o+rw /dev/diskXsY
jam -q @disk

And voilà, Haiku is installed on your Mac ! To boot on it, the best way is to install the rEFIt boot manager.

Instructions for VMware Fusion:

The command:

cd /Volumes/Haiku/haiku
jam -q haiku-vmware-image

will build a VMware disk image: [Mounted Disk Image]/haiku/generated/haiku.vmdk.
To use it, follow these steps:

  1. Create a folder at the root of the disk image.
  2. Copy [Mounted Disk Image]/3rdparty/vmware/haiku.vmx inside this folder, and edit the copy.
  3. Change ide0:0.fileName = "haiku.vmdk" to ide0:0.fileName = "../haiku/generated/haiku.vmdk". Save the file.
  4. Double-clicking on the file should start VMware Fusion and launch Haiku.

VMware will create some files in the folder you put haiku.vmx.
If you want easy access to the virtual machine file, make an alias of the haiku.vmx file (or put it into the Dock).
Lanching this alias will mount the disk image and start the VM, automatically.

Instructions for other virtualisation/emulation software:

Haiku should run in Q (free), Parallels Desktop (commercial) or VirtualBox (free).
Some of them (Parallels, …) can use the VMware disk image (see above).
For the others, you can create a raw disk image with:

cd /Volumes/Haiku/haiku
jam haiku-image

The image will be created in [Mounted Disk Image]/haiku/generated/haiku.image.

Installing Haiku to a partition from Linux

Article contributed by ekdahl on Thu, 2007-09-06 16:36
2010-January: This document is now obsolete. We are in the process of consolidating and re-organizing the website documentation. For now please refer to the in-progress website documentation.

This is a guide for you who have already been able to build an image of Haiku under Linux and running that with an emulator such as QEMU or VMWare and want to try Haiku natively with your real hardware.

Disclaimer: Do this on your own risk. I don't take any resposibility for any data loss caused by using this guide.

The following procedure have been tested with Kubuntu 7.04

I assume the following:

  • You are using Linux
  • You have a build system up and running
  • You are using GRUB as boot loader
  • You have a spare partition on which you want to install Haiku

The first thing you need to find out is the Linux name of your partition. A simple way of finding that is to run a partition editor. If you're using Gnome or Xfce, then use the application GParted, and if you are using KDE, the app to use is QTParted. In those applications you get a graphical view of your harddrives and partition layout.
The name of the partition can for example be
/dev/hdb3 - which means the third primary partition on the second PATA hard drive
/dev/sda6 - which means the second logical partition on the extended partition on the first SATA hard drive

Short simplified explanation of naming:
First letter: 'h' means PATA, 's' means SATA or USB drives
Third letter: 'a' means first drive, 'b' means second drive, and so on...
Digit: Partition number, 1-4 is primary partitions, one of these can be an extended partition which in turn contains logical partitions. The numbering of logical partitions start with 5.

Next step is to tell the build system that the "image" used for installing haiku on should be your partition instead of the file haiku.image which you have used previously. That can be done by overriding the variables HAIKU_IMAGE_NAME and HAIKU_IMAGE_DIR. The recommended way of doing that is to create a file called UserBuildConfig under trunk/build/jam. All your customizations to the image can be done here, like if you want to include extra drivers or applications which are not part of the standard image.
If your partition was at location /dev/sda6 the contents of UserBuildConfiq should read:


Make sure that you wrote the right partition, because the partition will be overwritten.

Now you're set to build Haiku. Issue this command in a terminal (under the trunk directory):

jam -q

If no errors occured you will be flooded with messages like
Error: Failed to open connection to FS shell: No such file or directory
But that's to expect, since you dont have write access to the partition you're trying to install haiku on.

To complete the installation simply run

sudo jam -q

And the actual installation to the partition will be performed. The reason for not running with sudo the first time is that you want the ownership of the compiled files to be your user account.

Now it's time to add a boot entry for Haiku in GRUB.
To edit GRUB's entries run

sudo kate /boot/grub/menu.lst


sudo gedit /boot/grub/menu.lst

depending on what editor you use.

GRUB uses a different naming strategy for harddrives than Linux. It uses a scheme like this:


Where N is the hard disk number, starting on 0. And all hard disks' name start with hd.
And n is the partition number, also starting on 0. The first logical partition always have the number 4, regardless of the number of primary partitions.
If you're still unsure, check out

As an example
/dev/sda6 would be (hd0,5) in GRUB (if there are no PATA drives installed).

The entry would finally be

# Haiku on /dev/sda6
title		Haiku
rootnoverify	(hd0,5)
chainloader	+1

This should be somewhere in your /boot/grub/menu.lst file.

That's it! Reboot to test. Good luck, you'll need it.

If you have updated the source and want to reinstall Haiku, just run

jam -q

from trunk and subsequently

sudo jam -q

And your partition once again is populated by a fresh install.

Building Haiku on Ubuntu Linux, Step by Step

Article contributed by leavengood on Sat, 2007-07-21 04:11
2010-January: This document is now obsolete. We are in the process of consolidating and re-organizing the website documentation. For now please refer to the in-progress website documentation.

Another article on this site already describes the basics of building Haiku on Linux. Since my distribution of choice is Ubuntu, I decided to get Haiku building on it and then provide a detailed step-by-step guide for others to follow.

I performed these steps on a fresh Ubuntu 7.04 (Feisty Fawn) install, but they should be similar for other versions and probably the same for most Debian-based distributions.

Getting and Building the Haiku Source Code

Article contributed by wkornewald on Sat, 2006-10-28 09:10

Document Obsolete

2010-January: This document is now obsolete. We are in the process of consolidating and re-organizing the website documentation. For now please refer to the in-progress website documentation.

Please note this document mainly pertains to building Haiku under BeOS R5 and later. If you're using a non-BeOS host platform, you might find this guide more useful.

Getting the source

All commands must be executed in the Terminal.

Go to the parent directory for Haiku's repository and enter:

svn checkout http://svn.berlios.de/svnroot/repos/haiku/haiku/trunk haiku

This will checkout the source into a new subdirectory called "haiku". Members of Haiku should login with their BerliOS account to get commit access:

Getting Linux Developer Tools

Article contributed by johndrinkwater on Tue, 2006-08-15 19:34
2010-January: This document is now obsolete. We are in the process of consolidating and re-organizing the website documentation. For now please refer to the in-progress website documentation.

What you need

You will need svn before starting this process; the other tools (jam, gcc et al) are built from our repository. Before attempting to build Haiku, one must get copies of the development toolchain. Keep in mind that the process will consume around 1 GiB of disk space.

Using Subversion with the Haiku Source Repository

Article contributed by axeld on Mon, 2005-03-07 05:00
2011-November: This document is now obsolete. Subversion is no longer in use. We are in the process of consolidating and re-organizing the website documentation. For now please refer to the in-progress website documentation.

As we've already announced earlier, we're planning to switch our version control system from CVS to Subversion. While CVS is working nice basically, it's much too limited to serve as a good foundation for a project of a size like ours.

The following document should give you an introduction on how to use Subversion with our repository - it will not provide you with many details, but with some pointers in case you want to know more about Subversion. The current version of Subversion is 1.1.3.

Syndicate content