Instantly share code, notes, and snippets.

What would you like to do?
How to create an OS X El Capitan VM that will run on Linux

How to create an OS X El Capitan VM that will run on Linux

VirtualBox only officially supports OS X guests on an OS X host, but it is possible to create one on an OS X host and transfer it over to a Linux host. This tutorial will go over one possible way to accomplish this task.

What you will need

  • An Apple computer running OS X 10.11
  • A Linux computer to transfer the VM over to
  • 20 GB free on the Apple Machine
  • 40 GB free on the Linux Machine

Step One: VMWare

Install VMWare Fusion Pro on your OSX Host ( ). Open it up and select File -> New.

On the "Select the Installation Method" menu, choose "Install OSX from the recovery partition". Follow the instructions and soon OSX will start installing in a VMWare VM. Go through the OSX installation process until the point where OSX asks you to setup the installation (IE: create users, etc). This could take up to two hours. When its done, shutdown the VMWare VM.

In the VMWare "Virtual Machine Library" menu, select the OSX VM you just created, and then select File -> Export To OVF.

This will create a folder with three files in it:

  • .mf
  • .ovf
  • .vmdk

Step Two: Modify the OVF Files

Next we need to take care of a few inconsistencies between VMWare's OVF format and VirtualBox's OVF format. Run the following commands on the .ovf file:

sed -i -e "s/vmware.sata.ahci/AHCI/g" <VM_NAME>.ovf
sed -i -e "s/ElementName/Caption/g" <VM_NAME>.ovf

Since we have modified the OVF file, its SHA1 checksum will have changed. We need to update the .mf file to account for these changes. The .mf file should look something like this:

SHA1(<VM_NAME>.ovf)= 640e7ddd6b5c69a9f9602e3664daaa92139b3214
SHA1(<VM_NAME>.vmdk)= 102282359761b742dddcf99405ad5b6989c1e467


shasum <VM_NAME>.ovf

Take the resulting hash and replace the hash after SHA1(<VM_NAME>.ovf)= in <VM_NAME>.mf with this result.

Copy the OVF folder with all three files over to the Linux Machine.

Step Three: Import OVF into Linux host VirtualBox

Open up virtualbox on the Linux host, and import the OVF. You'll need to set the VM OS Type to "Mac OS X" and the OS Version to "Mac OS X 10.11 El-capitan (64-bit)".

Next, open up a terminal and run the following VBoxManage commands:

VBoxManage modifyvm "$VM_NAME" --cpuidset 00000001 000306a9 04100800 7fbae3ff bfebfbff
VBoxManage modifyvm "$VM_NAME" --keyboard usb
VBoxManage setextradata "$VM_NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "MacBookPro11,3"
VBoxManage setextradata "$VM_NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "$VM_NAME" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata "$VM_NAME" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "$VM_NAME" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1

Now you should be able to boot up the VM and have it run properly on the Linux host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment