Install OS X Sierra on Proxmox

My Proxmox running on an old Intel i7 has been upgraded to the latest: 4.4-5. When started the Sierra installer prepared following the above guide, the menu bar was stuck at “Language Chooser” which prevent the launch of DiskUtility or Terminal. The issue isn’t new and has its ticket here:

https://github.com/kholia/OSX-KVM/issues/26

But I didn’t find any solution that worked for us. Maybe the setup is a bit unique.

I have to manually prepare a virtual disk for Sierra, in Linux. Of course it’s not worth mentioning if it’s done with a Mac. Here are the steps in Proxmox:

1, install hfsprogs, gdisk and parted:

apt-get install hfsprogs gdisk parted

2, make the GUID table for the VM’s LVM

# find the LVM volume for the VM in Proxmox, usually in the format: local-lvm:vm-100-disk-1
# then create a GUID partition table for it
gdisk /dev/pve/vm-100-disk-1
# use o command to create an empty partition table, all as default
# use n command to create a partition table, all as default. Use af00 as FS type(Apple HFS+)
# use w command to apply changes to the volume
# use q to quit

3, format the new partition to HFS+

# first you need to find the new partition
ls /dev/mapper/|grep 100
pve-vm--100--disk--1
pve-vm--100--disk--1p1
# the one with p1 is the HFS+ partition
# now format it with:
mkfs.hfsplus -J -v Main /dev/mapper/pve-vm--100--disk--1p1

4, set the GUID volume to bootable

parted /dev/pve/vm-100-disk-1
(parted) print
Model: Linux device-mapper (thin) (dm)
Disk /dev/dm-12: 34.4GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 34.4GB 34.4GB hfs+ Apple HFS/HFS+

(parted) disk_set
Flag to Invert? [pmbr_boot]?
New state? [on]/off?
(parted) quit
Information: You may need to update /etc/fstab.

5, mount the partition and copy the plist file over(used by the boot loader)

mount -t hfsplus -o force,rw /dev/mapper/pve-vm--100--disk--1p1 tmp
cd tmp
mkdir Extra
cat <<EOF >Extra/org.chameleon.boot.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Timeout</key>
<string>10</string>
<key>EthernetBuiltIn</key>
<string>Yes</string>
<key>PCIRootUID</key>
<string>1</string>
<key>KernelBooter_kexts</key>
<string>Yes</string>
<key>CsrActiveConfig</key>
<string>103</string>
</dict>
</plist>
EOF

6, remember to umount!

 umount tmp

7, start the VM in Proxmox and install! After the installation is finished, click Reboot and it will boot from the partition instead of the ISO and continue to setup.