Skip to content

Instantly share code, notes, and snippets.

@chrismckelt
Created April 14, 2018 10:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismckelt/cacfe23104acd8af6cef6ba42a2afbc6 to your computer and use it in GitHub Desktop.
Save chrismckelt/cacfe23104acd8af6cef6ba42a2afbc6 to your computer and use it in GitHub Desktop.
MAC Hyper V Virtualization ON in bios on boot
http://nuts4.net/post/hack-force-vt-x-to-be-always-on-when-booting-to-windows-on-your-macbook
HACK: Force VT-x to be always on when booting to Windows on your MacBook
05 APRIL 2016 JOE
Warning: While this worked on my 15" MacBook Pro (mid 2014, EMC 2881), and newer models based on the comments below, this messes with the Model Specific Registers on your Intel processor. Also, this WILL NOT WORK on AMD-based systems...should Apple ever release one. Before proceeding, ensure that rEFInd is supported for your specific Mac/processor. 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/Docker 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.
Go here and download rEFInd (the zip version): http://www.rodsbooks.com/refind/getting.html
Extract the zip to a folder, open the refind folder and edit refind.conf-sample.
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)
Shut down your computer.
After powering back up, press and hold Command+R before the chime/apple logo appears to boot into Apple Recovery.
Once in Apple Recovery, go to Utilities -> Terminal.
Navigate to the folder where you extracted rEFInd, and run ./refind-install
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.
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.)
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:
1
2
3
4
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.
Tags : macbook, apple, boot camp, windows, hyper-v, intel, vt-x, rEFInd, FunHax
Be the first to rate this post
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment