HACK: Force VT-x to be always on when booting to Windows on your MacBook

DANGER: While this worked on my 15" MacBook Pro (mid 2014, EMC 2881) and possibly works for other systems, this messes with the Model Specific Registers in your Intel processor.  While it's likely the MSR has the same layout between Apple laptops/computers, if they're not the same, there's the chance of bricking your system.  This only works for Intel-based systems...don't even try to use this process on AMD-based systems (should Apple ever release them.)  By following any of the steps outlined below, you agree to not hold me liable for any damages.  You've been warned!

Ok, if you're at this point, you've agreed to chance fate.  So, I got fed up that Apple's UEFI BIOS doesn't set VT-x enabled by default when a Boot Camp partition is started by default.  Having to boot into OS X, then reboot into Windows just so I can use Hyper-V is a huge time suck, and a bit ridiculous.

I sat out to find a solution, and had a hard time digging up information.  I stumbled upon a possible solution from 10 years ago using rEFIt, an EFI-based shell from ArchLinux, and some hacky EFI app to enable it, but the hacky solution only works for 32-bit mode...not 64-bit.

After researching about rEFIt, I found a newer version called rEFInd.  Turns out, it has the option to enable VT-x and lock it when it starts up.  If you're not familiar with rEFInd, it's a boot loader (similar to Grub) that is specifically built for EFI-based systems.  By using this bootloader to start Windows, VT-x will be enabled before the Windows kernel gets started, and Hyper-V will always work without a reboot into OS X.

  1. Go here and download rEFInd (the zip version): http://www.rodsbooks.com/refind/getting.html
  2. Extract the zip to a folder, open the refind folder and edit refind.conf-sample.
  3. In refind.conf-sample:
    Set the timeout to 5 seconds (or whatever you want)
    Find enable_and_lock_vmx, uncomment the line and set it to true (HERE BE DRAGONS)
  4. Shut down your computer.
  5. After powering back up, press and hold Command+R before the chime/apple logo appears to boot into Apple Recovery.
  6. Once in Apple Recovery, go to Utilities -> Terminal.
  7. Navigate to the folder where you extracted rEFInd, and run ./refind-install
  8. If a warning about SIP (System Integrity Protection) appears, press "y", and continue with the installation.  We're in Recovery Mode, so SIP should be disabled at this point.
  9. Note: The installer will copy the refind.conf-sample file to EFI/refind/refind.conf on your ESP partition.  If you need to change settings later on, you'll have to mount the partition first (use the first two commands from the uninstall instructions below to mount it.)
  10. Reboot your Mac. (Now, your Mac may freeze. If it does, press and hold the power button until the LCD turns off, then turn it back on.)

You'll be greeted by a GUI bootloader menu, which will load whatever OS you sat as your default.  In my case, this was Windows, and Hyper-V worked flawlessly from a cold boot!

Troubleshooting:

If for some reason rEFInd is not working, power off the Mac, hold the Option key and power back on. Keep holding Option until you get to the UEFI bootloader menu, and you can boot back into OSX.

If you change your default boot OS via Boot Camp, it may stop rEFInd from loading in the future. Just re-run the installer after changing the default boot OS, and it should fix the issue.

Uninstall:

If you need to uninstall rEFInd, boot back into Apple Recovery, go to Terminal, and (assuming your EFI partition is disk0s1) run the following:

mkdir /Volumes/ESP
mount -t msdos /dev/disk0s1 /Volumes/ESP
rm -R -f /Volumes/ESP/EFI/refind
umount /Volumes/ESP

Once that's complete, exit Terminal, click on the Apple menu in the upper left corner, and open Startup Disk. Select the disk you want to start by default, and reboot.