Installing macOS Mojave 10.14 Developer Beta on Proxmox 5.2

This tutorial for installing macOS Mojave has been adapted for Proxmox 5.2 from Kholia’s GitHub project for installing into vanilla KVM. There is more documentation there which will help out with enabling extra features and diagnosing problems!

Requirements

I’ll assume you already have Proxmox 5.2 installed. You also need a real Mac available in order to download Mojave from the App Store and build the installation ISO.

Your Proxmox host computer must have an Intel CPU (I believe you would need a custom Mac kernel in order to use an AMD CPU). Your CPU must be at least as new as Nehalem, which was the first CPU generation to bear the “Core” i5/i7 branding. Older CPUs will cause the finder to repeatedly crash after installation completes (with an Illegal Instruction exception in the graphics code).

Mojave is currently in developer preview, so you need to be a registered Apple developer to download the installer. This requires a $99/year subscription fee. As soon as it’s out of preview, it should be available on the app store for non-developers.

First step: Create an installation ISO

On a Mac machine, download and run the Mojave 10.14 developer beta preview installer from here:

https://developer.apple.com/download/

After running that installer, the Mojave preview will appear in the app store. Download it:

Now the Mojave installer will appear in the app store

Now run this script in order to create Mojave.iso from the installer. The ISO should get saved to your desktop. Upload the ISO to your Proxmox server’s ISO store (typically /var/lib/vz/template/iso).

Prepare a Clover image

We’ll be using Clover as a bootloader for Mojave.

Download this Clover disk image (that I built using kholia’s build script from Clover r4542), unpack it, and upload it to Proxmox’s ISO store at /var/lib/vz/template/iso. Although it has a .iso file extension, this is actually a hard disk image. (I do it this way because Proxmox has nicer tools for storing and picking .iso files for us)

Fetch the OSK authentication key

macOS checks that it is running on real Mac hardware, and refuses to boot on third-party hardware. You can get around this by reading an authentication key out of your real Mac hardware (the OSK key). Run the first bit of C code from this page (you’ll need XCode installed) and it’ll print out the 64 character OSK for you. Make a note of it.

Every Mac uses the same OSK, so don’t be surprised if it doesn’t look like a random string!

Create the VM

From the Proxmox web UI, create a new virtual machine as shown below.

In the Options page for the VM, make sure “use tablet for pointer” is set to “Yes”. Change “BIOS” to “OVMF (UEFI)”.

In the Hardware page for the VM, change the the Display to Standard VGA (std). Add a second DVD drive at IDE0, set it to use your Mojave.iso. Add an “EFI Disk” too.

Don’t try to start the VM just yet. First, SSH into your Proxmox server so we can make some edits to the configuration files.

Edit /etc/pve/qemu-server/YOUR-VM-ID-HERE.conf (with nano or vim). Add these two lines, being sure to subtitute the OSK you extracted earlier into the right place:

machine: pc-q35-2.11
args: -device isa-applesmc,osk="THE-OSK-YOU-EXTRACTED-GOES-HERE" -smbios type=2 -cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check

We’re telling macOS that the CPU is Penryn (it doesn’t seem to like booting otherwise), but we’re enabling all the new CPU features found in Nehalem which macOS will require, plus some optional features found in later generations (AVX/AES).

Find the line that defines the Clover ISO (ide2), and remove the “,media=cdrom” part from it. Add “,cache=unsafe” in its place.

On the net0 line, change “e1000” to “e1000-82545em”. This variant is supported by OS X.

Save your changes, return to the Options tab, and change the boot order to put IDE2 (the Clover image) first.

Configure Proxmox

On Proxmox, run “echo 1 > /sys/module/kvm/parameters/ignore_msrs” to avoid a bootloop during macOS boot. To make this change persist across Proxmox reboots, run:

echo "options kvm ignore_msrs=Y" >>/etc/modprobe.d/kvm.conf && update-initramfs -k all -u

You must now install a patched version of Proxmox’s OVMF library in order to be able to boot Mojave.

Install Mojave

Now start up your VM.

Go to the Console tab, quickly hit Escape at the Proxmox logo to enter the OVMF configuration. If your keyboard doesn’t work, leave the Console tab, stop the VM, start the VM, then re-enter the console tab. If pressing escape still doesn’t enter the menu, make sure you are using “machine: pc-q35-2.11” in your VM config and you do not have a USB keyboard defined in pve-q35.cfg (it seems that the OVMF menu only supports the default PS/2 keyboard).

Follow the steps above to set the screen resolution to 1024×768 and “reset” to apply the new settings (not “continue”). This step is required to avoid scrambled graphics on boot and a hang (Clover resolution must match OVMF resolution).

Mojave doesn’t support QEMU’s PS2 keyboard and mouse, but it does support the USB tablet we’ve selected on the Options page. Edit /usr/share/qemu-server/pve-q35.cfg and add a USB keyboard to the bottom of the file to replace the PS/2 one it would provide by default:

[device "keyboard1"]
 driver = "usb-kbd"
 bus = "ehci.0"
 port = "2"

(Port 1 is occupied by the USB tablet that Proxmox will provide for us)

We’ve added this to the config file instead of to the VM’s args directly. If we were to add it to the VM’s args, then when Proxmox constructs its call to KVM to launch the VM, the device definition would appear before the pve-q35.cfg file is included, which defines the USB busses. However, the device definition must appear after the definition of the USB bus that it refers to.

Note that this file is whitespace-sensitive, make you you don’t add any blank lines that have extraneous spaces on them.

Stop the VM and start it again to pick up this new keyboard config. It should now boot into Clover.

Clover boot screen

Press enter to boot the “Boot macOS Install from Install macOS 10.14 Beta” entry and the installer should appear. Choose your language.

Our virtual hard drive needs to be erased/formatted before we can install to it, so select the Disk Utility option. Follow the steps below to format the disk:

Now we’re ready to begin installation!

After the first stage of installation, the VM should reboot itself and automatically continue installation by booting from the hard drive, then reboot itself a second time and automatically boot from “filevault prebooter”.

Answer the initial install questions, and you’ll be logged on! (Note that you’ll probably want to hold off on logging into your iCloud account until you’ve configured your SMBIOS to your liking in Clover Configurator)

Finally!

Make the Clover install permanent

We’re currently booting using Clover from the attached CD image. Let’s install that to the hard drive instead. Pop open Terminal and run “diskutil list” to see what drives we have available.

Use “sudo dd if=<source> of=<dest>” to copy the “EFI” partition from the Clover CD and overwrite the EFI partition on the hard disk. The Clover CD is the small disk with the “linux filesystem” on it, and the main hard disk is the one with the large Apple_APFS “Container” partition on it.

In my case these EFI partitions ended up being called disk0s1 and disk1s1 respectively, so I ran “sudo dd if=/dev/disk0s1 of=/dev/disk1s1” (N.B. if you get these names wrong, you will erase the wrong disk and you’ll have to start the installation over again!).

Now shut down the VM, and remove both the Clover and the Mojave CDROM drives from the Hardware tab. On the Options tab, edit the boot order to place SATA0 as the first disk. Boot up. If everything went well, you should see the Clover boot menu, and you can select “Boot FileVault Prebooter from Preboot” to boot Mojave.

Sleep management

I found that I was unable to wake Mojave from sleep using my mouse or keyboard. You can either disable system sleep in Mojave’s Energy Saver settings to avoid this, or you can manually wake the VM up from sleep from Proxmox by running:

qm monitor YOUR-VM-ID-HERE
system_wakeup
quit

Editing your Clover/EFI settings

You can use the Clover Configurator tool (Global Edition) to edit your Clover “config.plist” configuration file, which is stored in the hard drive’s EFI partition. This tool should mount the EFI partition for you. If you want to mount it without using Clover Configurator, first check the device name of the EFI partition in the terminal:

~$ diskutil list
/dev/disk0 (external):
   #:             TYPE   NAME           SIZE       IDENTIFIER
   0: GUID_partition_scheme             512.1 GB   disk0
   1:              EFI   EFI            209.7 MB   disk0s1
   2:        Apple_HFS   Main           511.8 GB   disk0s2

Then you can mount it like so:

sudo mkdir /Volumes/EFI
sudo mount -t msdos /dev/disk0s1 /Volumes/EFI

USB passthrough

Since I want to use this as my primary computer, I want to use a USB keyboard and mouse plugged directly into Proxmox, rather than sending my input through the web VNC console.

Proxmox has good documentation for USB passthrough. Basically, run “qm monitor YOUR-VM-ID-HERE”, then “info usbhost” to get a list of the USB devices connected to Proxmox:

qm> info usbhost
 Bus 3, Addr 12, Port 6, Speed 480 Mb/s
 Class 00: USB device 8564:1000, Mass Storage Device
 Bus 3, Addr 11, Port 5.4, Speed 12 Mb/s
 Class 00: USB device 04d9:0141, USB Keyboard
 Bus 3, Addr 10, Port 5.1.2, Speed 12 Mb/s
 Class 00: USB device 046d:c52b, USB Receiver
 Bus 3, Addr 9, Port 14.4, Speed 12 Mb/s
 Class 00: USB device 046d:c227, G15 GamePanel LCD
 Bus 3, Addr 8, Port 14.1, Speed 1.5 Mb/s
 Class 00: USB device 046d:c226, G15 Gaming Keyboard

In this case I can add my keyboard and mouse to USB passthrough by quitting qm, then running:

qm set YOUR-VM-ID-HERE -usb1 host=04d9:0141
qm set YOUR-VM-ID-HERE -usb2 host=046d:c52b

This saves the devices to the VM configuration for you. It’s possible to hot-add USB devices, but I just rebooted my VM to have the new settings apply.

You can also pass through USB devices by passing through an entire USB controller using Proxmox’s PCIe passthrough feature.

26 thoughts on “Installing macOS Mojave 10.14 Developer Beta on Proxmox 5.2”

  1. Hi Nicholas,
    thank you very much, installation runs smooth. Have you tried GPU passthrough?
    Michael

    1. I’ve heard that the Nvidia drivers don’t offer acceleration yet (even after hacking them to force installation on the unsupported OS). I think we’ll have to wait for some time after the retail release before we get those.

      I have an AMD card I could try, I’ll report back with details.

  2. I was able to use GPU passthrough – but I haven’t found a solution to the frequently crashing finder – maybe I run proxmox on a Westmere CPU?

      1. Although being root I get a “-bash: /proc/cpuinfo: Permission denied”??
        Anyway: I am using an Intel Xeon X5660…

        1. That’s bizarre, I’ve never seen an error like that while trying to access cpuinfo. Are you missing the “cat” on the start of that command?

          Your CPU *should* be supported, because it’s a die-shrink of Nehalem and I’d expect it to have the same features.

          You might have to cat /proc/cpuinfo | grep flags and check if it lists ssse3 (note, three ‘s’s), sse4_2 and popcnt (the new features that Nehalem introduced over Penryn).

  3. Shame on me: to dumb for copy/paste!
    12x model name : Intel(R) Xeon(R) CPU X5670 @ 2.93GHz
    flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 popcnt aes lahf_lm pti tpr_shadow vnmi flexpriority ept vpid dtherm ida arat
    … everything there.
    Please ignore my stupid response.

  4. I’ve followed all steps above but for some bizarre reasons can’t get Clover to recognize the Mojave iso mounted on IDE0. I’m on the latest version of Proxmox (5.2-5) with all updates applied.
    Has anything changed recently that could cause this issue?

    1. And of course, right after I posted this comment, I found the solution.

      I mistakenly changed “media=cdrom” to “cache=unsafe” for BOTH ide0 and ide2. This is only necessary for ide2 (Clover), not ide0 (Mojave).

      Thanks for the great tutorial!

    1. I haven’t been able to get this working yet. I think there is an EFI driver needed for the keyboard.

      You can boot into the recovery mode to unlock the disk I believe (that’s a full copy of the OS so it supports the keyboard properly).

  5. Hi,

    i have problem – on booting I get error message. Do you have any idea how to solve it?

    kvm: -device ide-hd,bus=ide.0,unit=1,drive=drive-ide1,id=ide1: Can’t create IDE unit 1, bus supports only 1 units
    TASK ERROR: start failed: command ‘/usr/bin/kvm -id 101 -name MacOSX …’ failed: exit code 1

    1. From the message it sounds like you might have two ide devices on the same bus (e.g. 0 + 1). The second IDE drive needs to be assigned to number 2 rather than 1. (drive #1 would be the slave of #0, which isn’t supported).

        1. Edit the config file for the VM using SSH (it’s in /etc/pve/qemu-server) and rename the config line for ide1 to ide2.

  6. Now it looks like this – so what I need to change – because there is already ide2…?

    ide0: local:iso/osx.iso,cache=unsafe,size=5600M,media=cdrom
    ide1: local-lvm:vm-101-disk-1,cache=unsafe,size=64G
    ide2: local:iso/clover-r4428-amd64.iso,cache=unsafe

    Thanks in advance!

  7. Now it’s:

    ide0: local:iso/HighSierra.iso,cache=unsafe,size=5600M,media=cdrom
    ide1: local-lvm:vm-101-disk-1,cache=unsafe,size=64G
    sata0: local:iso/clover-r4428-amd64.iso,cache=unsafe

    and error still appears:
    kvm: -device ide-hd,bus=ide.0,unit=1,drive=drive-ide1,id=ide1: Can’t create IDE unit 1, bus supports only 1 units

  8. And there is next problems…

    1) Keyboard is ultra sensitive – it works, but single keypress effect 3-4 chars in system,
    2) After first step of installation and reboot it freezes on apple logo. I have double checked resolution, I try to setup it just before restart, I try to reboot after change – nothing helps…

    Aby suggestions?

    1. It sounds like you have forgotten to add the “cpu” argument to the args, which is required for proper timing, so the clock runs fast and the key repeat is accelerated.

      1. I have (from beginning) setup 1 socket, 4 cores, Penryn. Is there any other option?

        Is it connected with boot problem or its different problem?

        1. You are missing this in the “args” in your VM config file:

          -cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.