<divclass="title">Building Haiku on Mac OS X</div>
</div>
<divclass="topnav">
<p>
<ahref="../contents.html">Contents</a>
   
Back to <ahref="../installation.html">Installing Haiku</a>
</p>
</div>
<divclass="content">
<!--
TODO:
-->
<p>Even if Mac OS X is Unix based, building Haiku on it still requires some tweaks.
These instructions were tested on Mac OS X 10.5.5 (Leopard). They may not work on older versions of Mac OS X (Tiger, Panther etc.)</p>
<h1>Requirements</h1>
<ul>
<li>You will need the Xcode Tools: use the installer on your Mac OS X Install DVD, or download the latest version from <ahref="http://connect.apple.com/">Apple Developer Connection</a> (free registration required).</li>
<li>You must be logged in as <b>administrator</b> to install some tools.</li>
<li><ahref="http://www.macports.org/">MacPorts</a> will also be required (see Step 3 for installation tips)</li>
</ul>
<h2>Step 1: Case-sensitive disk image</h2>
<p>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.</p>
<p>1) Open Disk Utility (in /Application/Utilities)<br/>
2) Click "New Image", and enter the following parameters:</p>
<ul>
<li>Volume name: You should enter a short name without special character or spaces.</li>
<li>Volume size: the minimum volume size is 2.68 Gb, the recommended size is the double. Do not worry about making the image bigger, since only the consumed space will be used on your hard drive.</li>
<li>Volume format: Mac OS Extended (Case-sensitive, Journaled)</li>
<li>Encryption: You should say "none", unless you really want to slow down Haiku building…</li>
<li>Partitions: (Tiger users will not have this - just skip it): Choose No partition map.</li>
<li>Image format: Choose “sparse disk image”.</li>
<p>First, install <ahref="http://www.macports.org/">MacPorts</a> (A standard Installer package is provided)</p>
<p>Close your Terminal, and enter in a new one:</p>
<preclass="terminal">sudo port install gnuregex gawk wget</pre>
<p>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.</p>
<p>If you get an error "port: command not found", the MacPorts shell configuration is probably not taken into account. You probably have a <spanclass="path">~/.bash_profile</span> or <spanclass="path">~/.bash_login</span> file overwriting MacPorts config located in <spanclass="path">~/.profile</span>. When a "login shell" starts up, it reads the file <spanclass="path">"/etc/profile"</span> and then <spanclass="path">"~/.bash_profile"</span> or <spanclass="path">"~/.bash_login"</span> or <spanclass="path">"~/.profile"</span> (whichever one exists - it only reads one of these, checking for them in the order mentioned). Check the file used by Bash (in the mentioned order) and add these lines to the used file:</p>
<p>To save the file and quit the editor, type <spanclass="key">CTRL</span> <spanclass="key">X</span>, <spanclass="key">Y</span> and <spanclass="key">ENTER</span>. 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.</p>
<p><b>Warning!</b> When you copy-paste preformatted text from a web page, some versions of Safari replace every space with a no-break space. You can use the search/replace function of your text editor to replaces these "spaces" with real ones. (or copy the text by hand... or use another browser).</p>
<p>These patches are from the <ahref="http://www.freelists.org/archives/haiku-development/09-2008/msg00294.html">Haiku development mailing list</a>, thanks to their authors!</p>
<p>If you want to build Haiku with GCC4, use :</p>
<preclass="terminal">./configure --build-cross-tools-gcc4 x86 ../buildtools/</pre>
<p>If you do not now which one you should use, choose gcc2 : Original BeOS R5 binaries (and many Haiku optional packages) will not run on a gcc4 build.</p>
<pre>binutils and gcc for cross compilation have been built successfully!</pre>
<h2>Step 6: Customizing the UserBuildConfig</h2>
<p>Now you could already start to build RAW or VMWare images. Before we come to that, however, let's have a look at the UserBuildConfig that can be used to customize and automate some things.</p>
<p>In <spanclass="path">trunk/haiku/build/jam/</span> there's a <spanclass="cli">UserBuildConfig.ReadMe</span> that explains various options. <b>Don't</b> simply rename it and use it as UserBuildConfig!</p>
You start by duplicating the <spanclass="cli">UserBuildConfig.sample</span> and the remove the .sample suffix to get your <spanclass="cli">UserBuildConfig</span>. From the .ReadMe you can copy interesting parts into your config and customize them there.
<li>Change <tt>ide0:0.fileName = "haiku.vmdk"</tt> to <tt>ide0:0.fileName = "../haiku/generated/haiku.vmdk"</tt>. Save the file.</li>
<li>Double-clicking on the file should start VMWare Fusion and launch Haiku.</li>
</ol>
<p>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). Launching this alias will mount the disk image and start the VM, automatically.</p>
<p><b>Note:</b><i>For more information refer to the topic <ahref="install-vm.html">Running Haiku in a virtual machine</a>.</i></p>
<p>Some of them (like Parallels and Virtual box, maybe others) can use the VMWare disk image (see above). For the others you can create a raw disk image.</p>