FreeBSD on a Mac Mini
This article describes how I installed FreeBSD on a Mac Mini (Late 2012 model MD388LL/A).
Why would I want to do that?
I needed a small server that used minimal power, and the Mac Mini is basically a
laptop in a small form factor.
My previous NAS machine was large and used 45W of power, but the Mini uses a mere 15W.
Plus, I can mount it on a wall, up and out of the way.
FreeBSD 11.0 summary:
FreeBSD 10.0 summary:
I put FreeBSD on the entire disk. I could not figure out how to preserve the original macOS
- Prepare a method to run bless from macOS installation media.
You'll need to run the macOS command bless from the command line to make your FreeBSD disk partition bootable.
You'll run bless after the FreeBSD installation by booting a macOS installation image
from a USB stick or DVD-ROM drive.
Be advised that older macOS install discs will likely not boot on late model Mac Mini hardware.
I had another Mac running a version of macOS older than Mavericks, so I
this technique to create a Mavericks USB stick.
- Copy FreeBSD onto a USB Stick.
See the FreeBSD handbook for more info.
This section assumes you are running these commands on a Mac.
- Insert the USB stick into your Mac.
- Find the USB device name based on mount. The example below is from my machine where my USB stick is named "FAT2GB"; your mileage may vary.
/dev/disk1 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
/dev/disk2s1 on /Volumes/FAT2GB (msdos, local, nodev, nosuid, noowners)
- Unmount (but do not eject) the USB stick using Disk Utility.
- Write the FreeBSD image to the USB stick.
Be very sure you know the proper device name for your USB stick in the next step.
# dd if=FreeBSD-10.0-RELEASE-amd64-memstick.img of=/dev/disk2 bs=64k
10641+1 records in
10641+1 records out
697384960 bytes transferred in 674.222314 secs (1034355 bytes/sec)
- Boot the FreeBSD USB stick in the Mac Mini while holding down the Option key. FreeBSD
will be displayed as "Windows" by the Mac boot manager.
- Install FreeBSD
- Distribution Select - I chose: docs, no games, source.
- Guided Partitioning
- Entire Disk
- Partition Editor - You will see three GPT partitions that were created for you when you chose Entire Disk.
If you are using FreeBSD 11, then proceed to step g below.
If you are using FreeBSD 10, you won't use these GPT partitions. Highlight ada0 and select Modify, change partition scheme to MBR, and the next screen will have no partitions for ada0.
- Create a partition for FreeBSD and leave the mount point blank. This will become ada0s1.
- Highlight ada0s1 and select Create.
Create a freebsd-ufs filesystem partition that is less than the whole disk. You will need a swap partition and (optionally) other partitions as you deem necessary. The installer defaulted to 932 GB on my disk, so I subtracted 8GB for swap.
- Here is my final partioning scheme. I used a single freebsd-ufs root filesystem (don't judge me).
- Tip: use a fully qualified domain name for the hostname to avoid sendmail startup failure.
- Reboot to the OS X installer residing on a USB stick or DVD-ROM drive.
- Open a Terminal window and bless your FreeBSD partition with the macOS bless command.
- Reboot to FreeBSD.
- If you want the Mac Mini to power on automatically after a power failure, you can install the sysutils/pciutils port which will give you setpci. Put the following command in a startup script like /etc/rc.local to make the Mac Mini boot when power is restored:
setpci -s 0:1f.0 0xa4.b=0