Virtual Hackintosh, part 2: the easy route

In part 1 I explained some of the basic concepts behind the hackintosh. In this post I'll show the easy way to get a VirtualBox-based hackintosh system up and running.

Caveats

Although the steps in this post are relatively simple and straightforward, that simplicity comes with a price. There are at least two issues that will detract from the experience: available screen resolutions are limited, and iCloud/iMessage connectivity does not work.

Aside from the above issues, there is also currently no way to have accelerated graphics in VirtualBox due to a lack of drivers, and there may be problems with audio as well. I've not figured out any way around that, unfortunately.

The guide

The instructions here work as of macOS Sierra 10.12.1 and VirtualBox 5.1.10. If you are using other versions, things may have changed, and so there is no guarantee that this guide will be accurate.

Step 0: Prerequisites

In order to follow this guide, you will need:

Step 1: Create an installer disk

The first step in making a hackintosh is the creation of installation media. Start by downloading macOS Sierra from the App Store on your real Mac:

Download Sierra

You should see it in Applications after the download has completed:

Sierra in Applications

Connect your external drive and use the Disk Utility to erase it, using the following settings:

Erase drive

You should leave the name "Untitled" as is, since it'll make the next step easier. And besides, it'll be overwritten in the next step anyway.

Open a new Terminal window and enter the following:

sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ macOS\ Sierra.app

After entering your password and confirming the action, you'll need to wait while your drive is reformatted and macOS installer data is copied onto it. If you are using a slow USB flash drive, be prepared to wait.

Once the process completes, eject the drive.

Step 2: Create the VM

Open VirtualBox and create a new VM:

Create VM

For simplicity, use the above settings. In later screens, select 4096MB RAM, and create a dynamically allocated 60GB VDI virtual hard drive.

Step 3: Configure the VM

Certain VirtualBox settings are easier to configure via the command line, and some are just unavailable in the GUI. The VBoxManage command line tool allows for terminal-based control over VMs.

IMPORTANT: Before using VBoxManage, close all VirtualBox windows! Otherwise, certain settings may fail to apply, or you might even end up with a corrupted VM.

Enter the following commands to further configure the macOS VM, replacing (copyrighted Apple key) with the actual key that you can easily find online:

VBoxManage modifyvm macOS --vram 128 --usb on --usbehci off --usbxhci off

VBoxManage setextradata macOS "VBoxInternal/Devices/smc/0/Config/DeviceKey" "(copyrighted Apple key)"

Next, choose a screen resolution integer for the VM:

Enable your selected resolution like so:

VBoxManage setextradata macOS "VBoxInternal2/EfiGopMode" 4

Step 4: Connect your installer disk

This should be a simple step, but unfortunately VirtualBox makes it difficult. Although it is possible to connect USB devices to virtual machines, you cannot normally boot from them, and that is precisely what we need to do. Luckily, VirtualBox does provide a workaround for this via a virtual raw disk access file.

First, connect your installer disk to your VM host machine. Next, you'll need to determine its identifier on your machine. In Windows, you can do so on the command line by entering the following:

wmic diskdrive list brief

In *nix, you can inspect the output from the mount, df -h, lsblk, or parted -l commands.

Determine which disk represents your installer disk and remember its Windows DeviceID (usually in the format of \\.\PHYSICALDRIVE#) or *nix device name (usually in the format of /dev/sdX or /dev/disk#). It is important to note that you should use the name of the device itself and not of its partitions.

Next, create the raw disk access file. In Windows, you will need to launch a new command prompt as Administrator. In *nix, you may need to prefix the command with sudo. Enter the following:

VBoxManage internalcommands createrawvmdk -filename C:\usb.vmdk -rawdisk \\.\PHYSICALDRIVE#

Replace the filename above with an appropriate *nix path if you're not on Windows, and replace the physical drive identifier as needed.

In the same administrative command prompt, enter the following:

VBoxManage storageattach macOS --storagectl SATA --port 2 --type hdd --hotpluggable on --medium C:\usb.vmdk

Replace the filename above if necessary.

Step 5: Install macOS

Launch VirtualBox as Administrator in order to allow it to access the raw disk. Then, start the macOS VM. If VirtualBox asks to pick a startup disk or ISO, just cancel out of that dialog.

Once macOS boots up, use the Disk Utility to format the 60GB disk and then install macOS onto it.

After the installer completes, there will be a first run setup wizard. When prompted to sign in with your Apple ID, select "Don't sign in" since you won't be able to anyway. Also, when prompted to send diagnostics and usage data to Apple, uncheck that box. Since this isn't real Mac hardware, it would not be helpful for Apple to try diagnosing any issues from unsupported configurations.

Finishing up

Once macOS is up and running, you're effectively done. Congratulations!

Running

At this point, it's a good idea to shut down the VM, go to its storage settings, and remove the raw disk access VMDK file. You may want to remove it from VirtualBox's Virtual Media Manager as well.

If you would like to see the normal Apple start up screen instead of the verbose text mode, you can enter the following after closing all VirtualBox windows:

VBoxManage setextradata macOS "VBoxInternal2/EfiBootArgs" "usb=0x800 keepsyms=1 -serial=0x1"

The default boot arguments contain "-v", which enables verbose mode. The above command will overwrite those defaults to remove verbose mode.

Finally, you will want to disable power saving. VirtualBox seems to dislike it when the guest OS tries to sleep. Go to System Preferences, select Energy Saver, and disable both the computer and the display from going to sleep in the guest OS.

Next time

In part 3, I'll explain the more difficult route of creating a virtual hackintosh using Clover, which will allow for more screen resolutions and iCloud/iMessage connectivity.

 
comments powered by Disqus