[Home] [Services] [Philosophy] [Experience] [Software] [Publications] [Tips] [Contact]

Topics

Which platform?
Choosing a password
Network File System (NFS) Tuning
Infiniband on FreeBSD
Running an Open Source OS on an Intel Mac

BSD and Linux on an Intel Mac

Thanks to Glen Barber for this article, which was my primary source of information.

There are a lot of perfectly good Macs out there that have been rendered obsolete by Apple, since the latest versions of OS X will not install on them. While security is not as big a concern for OS X users as it is with Windows, it's still not a good idea to browse the web using an OS that's no longer receiving security updates.

Running an open source OS such as one of the many BSD or Linux distributions can breathe new life into your older Mac.

Installing FreeBSD or Linux on an Intel Mac can be a little tricky. Apple makes major changes to the EFI BIOS and tools like Bootcamp, rendering many of the instructions you might find on the web obsolete.

Below are instructions I've used with success to install FreeBSD 10.2 alongside OS X. Installing FreeBSD as the sole operating system is more challenging, since you may need a boot manager such as rEFIt that resides on the OS X partition.

Basic installation of FreeBSD onto a partition alongside OS X is a snap. The tricky parts are getting the partition created in the first place and then getting Mac to boot it.

I've had mixed results getting Boot Camp to recognize a FreeBSD partition. It works on my 2007 MacBook Pro, but not on my 2007 iMac.

The easiest and most reliable approach I've found is using rEFIt or its descendent, rEFInd.

rEFIt

To use rEFIt, just install following the instructions at the rEFIt link above. To activate it, you must then run the following command from a Terminal window:

/efi/refit/enable.sh

When you reboot, the rEFIt boot menu should automatically appear.

Insert the FreeBSD install CD/DVD before rebooting and simply select it from the rEFIt menu. From here, installing FreeBSD should work exactly as it does on any other PC with another operating system installed and the new FreeBSD installation should appear in the rEFIt boot menu after the next reboot. Be aware, however, that it may appear as a Windows icon by default. This is not a problem. Just select it anyway, and FreeBSD should boot normally.

Partitioning the Disk with Boot Camp

Boot OS X and run Boot Camp Assistant.

With newer versions, you will need to insert a Windows 7 installation DVD, or Boot Camp will not allow you to partition the disk. Find a Windows 7 installation DVD, insert it, click Continue and partition the disk as you like. When Windows installation begins, just cancel it and reboot.

After reboot, eject the Windows DVD and insert the FreeBSD DVD.

Partitioning with Disk Manager

You can also partition the disk using Disk Manager (in the Utilities folder under OS X). Select the disk and choose the "Partition" tab. You can now shrink your OS X partition by grabbing the lower right corner and dragging it up. This may fail if you try to shrink it too much, due to fragmentation of the HFS filesystem.

FreeBSD Installation

To boot the FreeBSD installation disk, you can either hold down the Option key to get to the Boot Camp boot menu, or if you've installed rEFIt, just let the system boot to the rEFIt menu. Either way, select the FreeBSD installation disk from the menu.

Now comes the easy part. Just follow the normal FreeBSD installation procedure, with attention to the instructions below.

  1. Delete the Windows partition(s) created by Boot Camp Assistant
  2. If you want to use automatic partitioning:
    1. Select Auto
    2. Select Partition. This should automatically create the following partitions:
      • freebsd-boot
      • freebsd-ufs
      • freebsd-swap
  3. If you want to use manual partitioning:
    1. Select Create
    2. Add a freebsd-ufs partition with Mountpoint: /
    3. Answer Yes to creating a boot partition
    4. Add a swap partition
    5. Add other UFS partitions you want

      * Note the device name for the freebsd-boot partition. (It will be something like ada0p4) You will need this for the final step.

    6. Select Finish & Commit
  4. After installation, select Exit, answer No to opening a shell, and select the Live CD option rather than Reboot, and log in as root.

    <-- Note: It is very important that the gpart commands below are run under the Live CD option AFTER installation. Other shell or Live CD options are not the same. In the other cases, the gpart command below will install a bootcode for your CD, not the new installation. -->

        gpart show
    	Note the device (e.g. ada0) in the top line of output.
    	Note the index of the freebsd-boot partition (e.g. 4).
        gpart bootcode -b /boot/pmbr -p /boot/gptboot -i your-index your-device
        

    Example:

        gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 4 ada0
        

Reboot and your FreeBSD installation should appear in the Boot Camp or rEFIt menu.

You may also need to allow rEFIt to update your MBR table before it will boot the FreeBSD partition. Choose "Start Partitioning Tool" in the rEFIt menu, and it will tell you if the MBR needs to be synchronized.

In theory, the process should be similar for other BSDs and most Linux distributions, although my most recent attempt to install Debian 8.2 ended with the boot loader freezing.

Fixes

There was a regression in the Apple Touch Pad driver that causes the touch pad to stop responding as the computer warms up. If your system exhibits this system, this script should fix it, provided you have the FreeBSD source code installed.

This script can be used to remap the lower-right "enter" key to a Ctrl key and the right "Command" key to another Alt/Meta key for your Xorg session. Edit to taste...

The following sysctl settings greatly improved performance for the ATP driver on my 2006 white MacBook:

hw.usb.atp.scale_factor=10
hw.usb.atp.touch_timeout=50000
hw.usb.atp.double_tap_threshold=100000