Home

Awesome

macOS VirtualBox VM Instructions

Current macOS version: High Sierra (10.13), tested with VirtualBox 5.2.16 r123759

To build a VM running macOS, follow the directions below:

  1. Download the installer from Mac App Store (it should be available in the 'Purchases' section if you've acquired it previously). The installer will be placed in your Applications folder. (Should work for Yosemite, El Capitan, Sierra and High Sierra, Mojave - 10.10-10.14.)

    • Note: On newer hardware, you might not be able to download older OS releases that Apple doesn't support on the newer hardware (e.g. the 2016 MacBook Pro can only download 10.12 Sierra or later). In this case, you need to use an older Mac to download the older OS.
  2. Make the script executable and run it: chmod +x prepare-iso.sh && ./prepare-iso.sh.

    If the script fails to find the installer you can specify its path as the first parameter. By default, the output is saved as <Yosemite|El Capitan|Sierra|High Sierra|Mojave>.iso on the Desktop. You can change this using the second parameter. Example:

     ./prepare-iso.sh /Applications/Install\ macOS Sierra\ 2.1\ Beta\ 2.app sierra-2.1-b2
    
  3. Open VirtualBox and create a new VM.

  4. Set:

    • name: Choose a name
    • type: Mac OS X
    • version: Mac OS X (64-bit).
  5. Follow the rest of the VM creation wizard and either leave the defaults or adjust to your liking.

    • For Big Sur, the installer requires the disk to have at least 35.3 GB.
  6. Go into the Settings for the new VM you created and: 1. Under 'Display', increase the Video Memory to at least 128MB, otherwise macOS might not boot correctly, and display performance will be abysmal. 2. Under 'Audio', uncheck 'Enable Audio', otherwise the VM may display 'choppy' performance.

  7. In Terminal, run the command VBoxManage modifyvm VM_NAME --cpuidset 00000001 000306a9 00020800 80000201 178bfbff (where VM_NAME is the exact name of the VM set in step 4) so the VM has the right CPU settings for macOS.

  8. Click 'Start' to boot the new VM.

  9. Select the iso created in step 2 when VirtualBox asks for it.

  10. In the installer, select your preferred language.

  11. Open Disk Utility and format the volume: 1. Go to Utilities > Disk Utility, select the VirtualBox disk, and choose Erase to format it as:

    • For macOS < 10.13, choose Mac OS Extended (Journaled)
    • For macOS 10.13 and later, choose APFS.
  12. Quit Disk Utility, and then continue with installation as normal.

Troubleshooting & Improvements

Larger VM Screen Resolution

To control the screen size of your macOS VM:

  1. Shutdown your VM

  2. Run the following VBoxManage command:

     VBoxManage setextradata VM_NAME VBoxInternal2/EfiGopMode N
    

Replace VM_NAME with the name of your Virtual Machine. Replace N with one of 0,1,2,3,4,5. These numbers correspond to the screen resolutions 640x480, 800x600, 1024x768, 1280x1024, 1440x900, 1920x1200 screen resolution, respectively.

The video mode can only be changed when the VM is powered off and remains persistent until changed. See more details in this forum discussion.

Notes

Author

This project was created in 2015 by Jeff Geerling.