Skip to content

Instantly share code, notes, and snippets.

Last active January 10, 2023 23:38
Show Gist options
  • Save tap52384/9971deac57ea5ba9f39fcde0a84cbcf2 to your computer and use it in GitHub Desktop.
Save tap52384/9971deac57ea5ba9f39fcde0a84cbcf2 to your computer and use it in GitHub Desktop.
Bootcamp via Virtualbox 5.2 on macOS Mojave


directions for getting windows 10 to work with virtualbox 5.2 based on this page

Tools Used


Install Windows 10 via Boot Camp Assistant

  • Requires you to remove any external hard drives before continuing
  • Probably should download the Boot Camp Support Software prior to installing Windows 10 to a USB key for installation
  • Boot back into macOS when you are done and confirmed all drivers are installed

Install VirtualBox on macOS

Unmount the BOOTCAMP partition

In order to use your bootcamp partition with VirtualBox it will need to be unmounted first. This can be done manually from the Terminal using the following commands:

diskutil list
diskutil unmount /Volumes/BOOTCAMP <--- this is the name of the BOOTCAMP volume
sudo chmod 777 /dev/disk0s1 <--- This is the drive number of the EFI disk
sudo chmod 777 /dev/disk0s3 <--- This is the drive number of the BOOTCAMP disk

If your bootcamp volume doesn't have a name for some reason, use /Volumes/Untitled.

Create a VirtualBox raw disk image for the BOOTCAMP partition

To create an image that represents an entire physical hard disk (which will not contain any actual data, as this will all be stored on the physical BOOTCAMP partition). You will need the following information from diskutil list:

  • /dev/disk0 (internal, physical):
  • /dev/disk0s1 - the drive number of the EFI disk
  • /dev/disk0s3 - the drive number of the BOOTCAMP disk
mkdir ~/virtualbox
cd ~/virtualbox
sudo vboxmanage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename win10raw.vmdk -partitions 1,3
sudo chown your_username_here *.vmdk

Please note that vboxmanage internalcommands is an internal tool and is completely unsupported and will change in compatible ways without warning.

This command will create an image that will reference the EFI and BOOTCAMP partitions on our internal hard drive. If this command fails, then you may need to disable System Integrity Protection. This requires you to boot into Recovery Mode and execute the following command csrutil disable:

-bash-3.2# csrutil status
System Integrity Protection status: enabled.
-bash-3.2# csrutil disable
Successfully disabled System Integrity Protection. Please restart the machine for the changes to take effect.

Documentation on configuring System Integrity Protection can be found here and here.

Create a new VM

  • In the Finder menu, go to Machine --> New.
  • Click Expert Mode to continue.

In the Name and operating system window:

  • Name: Boot Camp
  • Type: Microsoft Windows
  • Version: Windows 10 (64-bit)
  • Memory Size: 4096 MB
  • Use an existing virtual hard disk file: ~/virtualbox/win10raw.vmdk Click Create. In the main application window, select the Boot Camp VM and click Settings.

In the System --> Motherboard settings:

  • Boot Order: Only check Hard Disk and Optical and move Hard Disk before Optical
  • Enable EFI (special OSes only): Checked

In the System --> Processor settings:

  • Processors: 4
  • Execution Cap: 100%
  • Enable PAE/NX: Checked

In the System --> Storage settings:

  • Controller: SATA: Check the Use Host I/O Cache option

Click OK to save these settings.

You should now be able to run Windows 10 from your BOOTCAMP partition!

Remember that you have to complete the steps under Unmount the BOOTCAMP partition upon every restart.

Automatically unmount the BOOTCAMP partition upon boot into macOS

There may be a way to prevent the partition from mounting upon boot using the vifs command as detailed on this page

Copy link

I get stuck in the UEFI Interactive Shell

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