Building Haiku on Mac OS X 10.10 Yosemite
This was written by Sambuddha Basu or samgtr on IRC.
The following was tested on Mac OS X 10.10 (Yosemite).
- 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 or Homebrew will also be required
- Case-sensitive disk image
- Fetching the buildtools and the Haiku source code
- Install pre-requisite software
- Building the buildtools
- Building Haiku
- Emulating Haiku
Step 1: Case-sensitive disk imageThe 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.
- Open Disk Utility (in /Application/Utilities)
- Click “New Image”, and enter the following parameters:
- Name: Name of the volume. It should not contain special characters or spaces.
- 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.
- Format: Mac OS Extended (Case-sensitive)
- Encryption: none
- Partitions: No partition map
- Image Format: sparse disk image
Step 2: Fetching the buildtools and the Haiku source codeOpen 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. In this case, it is named “Haiku”, so if you chose another name, use it instead of “Haiku” after “/Volumes/”.
Checkout the buildtools:
git clone git://git.haiku-os.org/buildtoolsor (if the git protocol is blocked by a firewall, or if you prefer to access the source through an encrypted channel):
git clone https://git.haiku-os.org/buildtools
Checkout the source code:
git clone git://git.haiku-os.org/haikuor:
git clone https://git.haiku-os.org/haikuYou should now have two folders “haiku” and “buildtools” into the mounted disk image.
Step 3: Install required software
To install the prerequisite software using Macports do the following:Install MacPorts (a standard Installer package is provided). Close your Terminal, and enter in a new one:
sudo port install cdrtools gawk wget nasm less mpfr gmp libmpc(Also important: make sure you have the latest version of "bison" installed!)
You will be prompted for the administrator password of the current account. If you get an error “port: command not found”, the MacPorts shell configuration, stored in ~/.profile, is probably not configured correctly. 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/infoIf 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.
Note: the ARM port is not yet supported for OS X, MacPorts has mtools but is missing sfdisk at least.
To install the prerequisite software using Homebrew instead, do the following:Install Homebrew using the ruby command line installer provided on the linked page. Next install the prerequisite software to build Haiku using the following command:
brew install cdrtools gawk wget nasm homebrew/dupes/less mpfr gmp libmpcNote that you'll need to install gnu less from the dupes repository as OS X comes with BSD less while Haiku requires GNU less.
Also important: make sure you have the latest version of "bison" installed!)
To override an older system version of "bison", you enter:
brew install bison brew link bison --forceAfter installing the prerequisite softwares, install the modified Haiku jam:
cd /Volumes/Haiku/buildtools/jam make sudo ./jam0 install [Enter your password]Reopen a new Terminal, and enter
jam -v. You should get:
Jam 2.5-haiku-20111222. OS=MACOSX. Copyright 1993-2002 Christopher Seiwald
Step 4: Building the buildtoolsConfigure a GCC 2.95 Hybrid, from a non-Haiku platform
mkdir /Volumes/Haiku/haiku/generated cd /Volumes/Haiku/haiku/generated ../configure --use-xattr --build-cross-tools x86_gcc2 ../../buildtools/ --build-cross-tools x86
./configurehas some more options: use
./configure --helpto list them. After some time, you should get:
binutils and gcc for cross compilation have been built successfully!
Step 5: Building Haiku
Compiling a basic raw Haiku disk imageThis is the most basic build, it generally is good for quickly testing the OS after making modifications as it doesn't contain a lot of extra applications. Be sure to modify -j2 with the number of cpu cores on your build system to ensure the fastest build times.
jam -q -j2 @image
Compiling raw nightly disk imagesThis is the default nightly image build target. This contains a complete system with an included compiler. Be sure to modify -j2 with the number of cpu cores on your build system to ensure the fastest build times.
jam -q -j2 @nightly-raw
Step 6: Emulating Haiku
Instructions for VirtualBoxFor emulating Haiku in VirtualBox, follow this guide.
Installing to the hard driveYou can boot Haiku 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 Disk Utility may help.
diskXsY, where X is the disk number (starting with 0), and Y the partition number (starting with 1). You can use the
diskutillist 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 @diskHaiku is installed on your Mac ! To boot on it, the best way is to install the rEFIt boot manager.