# FreeBSD 10.2 as sole OS on Intel Mac



## outpaddling (Oct 12, 2015)

Wondering if anyone has successfully installed FreeBSD on an Intel Mac without Bootcamp or rEFIt.

I verified that the instructions for dual booting at the links below also work with 10.2-RELEASE.

https://forums.freebsd.org/threads/installing-freebsd-on-intel-mac-mini.41913/
https://glenbarber.us/2011/11/12/Dual-Booting-OS-X-and-FreeBSD-9.html

However, I have an older MacBook and iMac that can no longer run a supported OS X and I'd rather not waste time maintaining an installation that isn't useful or secure anymore.  I'd rather dedicate the whole disk to FreeBSD.

Thanks,

    Jason


----------



## jrushford (Oct 16, 2015)

Jason,

I have FreeBSD 10.2 running on an old 2006 Macpro1,1 Intel Mac with mirrored zfs file system.  Shown is the layout of one of the disks, the other disk is partitioned identically.  After installing FreeBSD, I manually installed the MBR bootloader on both drives:

`# gpart bootcode -b /mnt/boot/pmbr -p /mnt/boot/gptzfsboot -i 1 ad0`
`# gpart bootcode -b /mnt/boot/pmbr -p /mnt/boot/gptzfsboot -i 1 ad1`

I also had a Mac OS X disk installed and then rebooted into Mac OS X.  I used diskutil to identify the two FreeBSD disks and then blessed the boot partitions on the two FreeBSD disks using

`# bless --device /dev/disk1s1`
`# bless --device /dev/disk2s1`

Where disk1s1 and disk2s1 are the freebsd-boot partitions.  The bless command loads the volume bootability info into nvram.  When you boot and hold down the option key, you'll see the disks that you can boot from.  Choose one of the freebsd disks and the machine will then boot freebsd.  Once you have it working, remove the Mac OS X disk and when you boot the machine, it will choose the first bootable disk.  Thats how it's working on my old Mac Pro.

BTW, I loaded FreeBSD on the machine for the same reason, the 2006 macpro1,1 cannot run Mac OSX beyond lion.  It's a good machine still, has 4 XEON CPU's and 32GB of memory and I can add two more disks later to the zpool.  Going to get some 2TB drives for that and use it as a NAS and X windows workstation.  I'm using xfce currently with the nvdia-driver-304 from ports.


```
# gpart show ada0
=>       34  976773101  ada0  GPT  (466G)
         34          6        - free -  (3.0K)
         40       1024     1  freebsd-boot  (512K)
       1064        984        - free -  (492K)
       2048   33554432     2  freebsd-swap  (16G)
   33556480  943216640     3  freebsd-zfs  (450G)
  976773120         15        - free -  (7.5K)
```


----------



## outpaddling (Oct 16, 2015)

Thanks for the detailed info.  I tried a similar approach using an external disk a while back.  Both then, and now with a dual boot situation, I haven't had any luck with the bless command.

Below is the result on a MacBook Pro 2,2 running Lion with Boot Camp:


```
<<<ROOT@pro>>> /Users/bacon 77 # bless --device /dev/disk0s4 --label FreeBSD --verbose
EFI found at IODeviceTree:/efi
Refitting to width 43
Refitting to width 87
Can't read HFS+ VH for device /dev/disk0s4: -123
Error while setting scale 1 label for /dev/disk0s4
```

disk0s4 (ada0p4 in FreeBSD's eyes) is the boot partition, disk0s5 is UFS2 and disk0s6 is a swap partition.

BTW, the latest Boot Camp Assistant requires a Windows 7 DVD inserted, or it will refuse to even partition the disk.  I found one, inserted it, started the process and canceled the Windows installation once it started.  It booted right back into the Windows install.  Apparently it locks the startup disk to the Windows DVD. I had to cancel again and hold the Alt/Option key during the next reboot to change the startup disk back to the hard drive.

For now, I'd just like to figure out how to dual boot without using rEFIt.  Eventually, it would be nice to have a way to install FreeBSD without any intervention from OS X.  In theory it should be possible for a FreeBSD installation to bless itself, although maybe the code for this has never been written.  On PPC Macs, we can just install FreeBSD, use the whole disk, and it works.  Not sure how similar the PPC and Intel firmware are.


----------



## jrushford (Oct 16, 2015)

Jason,

I recall now that some of the other options cause the bless command to fail.  Try again using only the --device option as in

`# bless --device /dev/disk0s4`

Also, it's required that you have a MBR boot loader.  I showed the command above for loading the MBR boot loader for a ZFS filesystem. If you installed FreeBSD using a ufs filesystem, I think you need to use gptboot instead of gptzfsboot.

Also, I did not use bootcamp at all.  I put empty disks in my Macpro and booted from the DVD drive and installed FreeBSD on the empty disks.  I only booted up Mac OS X later to bless the two FreeBSD disks.  Having done so, the Mac OS X disk is no-longer in the machine.

John


----------



## outpaddling (Oct 16, 2015)

I did run

`gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 4 ad0`

from the live CD session before exiting the FreeBSD installer.

Removing the --label from the bless command eliminated the error message, but it still doesn't list the FreeBSD partition on boot.  I just get OS X and Recovery disk options.

I'll keep trying...

Thanks,

     Jason


----------



## jrushford (Oct 17, 2015)

Interesting, I didn't have any problems at all with my Mac Pro.  The only other thing that I can think of is that I used the FreeBSD-10.2-RELEASE-amd64-dvd1.iso img to install with.  Originally I tried the uefi image, FreeBSD-10.2-RELEASE-amd64-uefi-dvd1.iso, but the macpro would not boot afterward i.e, did not show as a bootable drive after blessing the boot partition.


----------



## outpaddling (Oct 17, 2015)

Got it working with and without rEFIt on my 2007 MacBook Pro.  Glen Barber's instructions at

https://glenbarber.us/2011/11/12/Dual-Booting-OS-X-and-FreeBSD-9.html

appear to be sufficient without rEFIt.  I think my problem was that I originally ran the gpart commands from the "Shell" option during installation instead of "Live CD".  I don't know why this would matter, but it's the only variable between my multiple attempts that I can see.  I suppose it's also possible that rEFIt succesfully blessed the partition where my manual bless commands failed.  Either way, rEFIt is no longer needed, as it shows up in the menu (as "Windows") when I hold the Option key during boot.  I've removed rEFIt and all is well.

Installation with bsdinstall went smoothly, including WIFI network configuration.

I'm running sysutils/desktop-installer right now.

FYI, my first install was on a 2007 iMac 17".  I'm also running XFCE (via desktop-installer).  That installation works beautifully.  The XFCE GUI is lightening fast - much faster than OS X.  The setup also went down without a hitch.


----------



## jrushford (Oct 17, 2015)

I'm pretty happy with my Mac Pro installation.  I have netatalk afp sharing on my home file system, xfce,  and am using the plex media server where I put all our ripped dvd movies.   I'm going to have to install 2 more disks as the filesystem is starting to fill up.  That'll be easy with ZFS though.

Glad you got it working, enjoy!


----------



## andersbo87 (Oct 26, 2015)

jrushford said:


> Interesting, I didn't have any problems at all with my Mac Pro.  The only other thing that I can think of is that I used the FreeBSD-10.2-RELEASE-amd64-dvd1.iso img to install with.  Originally I tried the uefi image, FreeBSD-10.2-RELEASE-amd64-uefi-dvd1.iso, but the macpro would not boot afterward i.e, did not show as a bootable drive after blessing the boot partition.


If I remember correctly from the time I used a Mac (I had one until spring of 2015), I had to copy /boot/boot1.efi to the EFI partition of the Mac. If you want to use EFI to boot FreeBSD on your Mac, you have to make sure that the system has an EFI partition.
When you boot the install media and get to the point where you can edit, create or remove partition, make sure there is a partition of EFI on your disk. If there is no such partition, create it (replace "freebsd-ufs" with "efi"). A partition size of 200 MB should be more than enough space.
If you already have such a partition, you may go ahead and create the other partitions and install FreeBSD. BUT, when the installer asks whether you want to make any final manual changes, say yes. (on the next prompt, you may have to type "root" as a username to gain access to the shell.)
Inside the shell, mount the EFI partition and copy /boot/boot1.efi to EFI/BOOT/bootx64.efi, like this example:
`gpart show ada0`
`mount -t msdosfs /dev/ada0p1 /mnt/` (assuming that the efi partition is on the first partition)
`mkdir -p /mnt/efi/boot`
`cp /boot/boot1.efi /mnt/efi/boot/bootx64.efi`
`umount /mnt`
In this example I used /mnt when mounting the EFI partition. Feel free to use other mountpoints if other partitions are mounted to /mnt.
When you reboot and press the alt (or whatever key to access the bootable drives on the Mac), "EFI boot" should now appear. Select that and you should be good to go.
That was how I got FreeBSD to boot on my earlier MacBook Pro when using EFI.


----------



## jrushford (Oct 27, 2015)

Thanks for the post.  I'll try this if I ever have to reinstall.


----------



## outpaddling (Jan 24, 2016)

FYI, FreeBSD is running well on both my iMac and MacBook Pro now.

I've posted my experience here:

http://acadix.biz/freebsd-intel-mac.php
There is an issue with the touchpad on the MacBook, but a pkg upgrade seems to have oddly improved it, but not eliminated it.  The touchpad responsiveness gradually fades out over maybe half an hour and eventually the mouse cursor simply doesn't move at all.  This used to happen within a few minutes.  A USB mouse works fine indefinitely.


----------



## npaisnel (Mar 2, 2017)

Did anyone with a FreeBSD on an Intel Mac Pro ever get fan speed control / heat management working on BSD on the Mac?

I managed to get NAS4Free installed on an IDE drive on the spare IDE channel under the DVD drive, as an embedded image.
Tried both other boot loaders, (rEFIt and rEFInd and they showed a FreeBSD icon but would not boot).
Did not 'bless' any drives and it does just boot.
But sometimes it randomly fails or hangs and wondering if that is heat / hardware related.


It is a  Mac Pro 1,1 Quad Core 2.66 and after a few minutes of running it starts 'freezing' up ..and I think the issue is heat related.
The RAM gets almost too hot to touch.
Fans only run at minimum speed and never speed up, and the CPU core temps on Processor 0 go up to about 45 degC, where as the other processor cores are down to around 28degC

I know I do not have FreeBSD, but have NAS4Free, but no one has been able to help or even answered my questions over on the NAS4Free forums, so I though that maybe there is some FreeBSD fan control deamon that needs to be installed that is not natively in NAS4Free.

Anyone have any ideas?


I am going to cross post this..yes I know..bad form...on to other threads I find with Mac Pro users ..as we seem to be so few and far between.   I want to get as much coverage as possible. I have been 3-4 weeks working on this before posting any posts on any forums, and I am now starting to think I am just going to trash the Mac if I can't get it running with NAS4Free


----------



## Beau Slim (Apr 19, 2017)

npaisnel said:


> Did anyone with a FreeBSD on an Intel Mac Pro ever get fan speed control / heat management working on BSD on the Mac?
> ...
> But sometimes it randomly fails or hangs and wondering if that is heat / hardware related.
> ...
> Anyone have any ideas?



I'm just in the process of getting FreeNAS or FreeBSD 11 running bare metal on my 1,1 instead of in esxi 6.0, so I don't have any perfect solutions yet, but assuming there is no software solution for our ancient hardware, here's what I do for esxi:  I have smcFanControl installed on Lion on an external bootable USB drive.  When I go to boot up esxi, I start by booting Lion, let smcFancontrol set the fans, and then reboot into esxi.  It's a terrible kludge, but it works.  FYI, there's a Linux package called mbpfan that is current, works well on the 1,1 and might be a starting point if there's nothing around for FreeBSD.  

Amazing that such old kit is still useful!


----------



## npaisnel (Apr 19, 2017)

Wonder why /how the smcFan control persists after a reboot.. most odd.

I scrapoed my 1.1 as it hardware issues.


----------



## tingo (Apr 19, 2017)

npaisnel said:


> Wonder why /how the smcFan control persists after a reboot.. most odd.


Probably because it is an embedded controller, and the settings / firmware you load (via smcFancontrol) persists until a power cycle.


----------



## npaisnel (Apr 19, 2017)

ok, so how do you initiate a shut down from OSX , that reboots with  the other OS without it power cycling ?  Does the built in 'Apple Reboot' menu item do this ?  Guess it does


----------

