23

I need to enable VT-x on my MacBook Pro, but I don't know whether it's enabled or not. Are there commands for checking the status of, enabling, or disabling VT-x?

Those are my device specifications:

MacBook Pro (Retina, 13-inch, Early 2015)

OS: OS X El Capitan 10.11.2
CPU: 2.7 GHz Intel Core i5
RAM: 8 GB 1867 MHz DDR3

24

According to Intel® Core™ i5-5257U Processor, it supports Intel Virtualization Technology (VT-x).

You can also from Terminal use the following command:

sysctl -a | grep machdep.cpu.features

If you see VMX in the output, then the CPU supports the Intel VT-x feature.

If you don't want to have to read through the output of CPU features and just see if VMX is there, then use: sysctl -a | grep -o VMX

From Intel-based Macs: Using VT-x virtualization technology:

Intel VT-x technology is enabled on Intel-based Macs. Make sure your Intel-based Mac has all available EFI updates installed; also update any third-party virtualization software.

Therefore there is no reason to check the status.

As to enabling/disabling, there is no direct user interface for that. Since it is enabled by default, the only way I can think of to disable it would be to hack the EFI Firmware. Which is not something I'd recommend doing!

| improve this answer | |
  • This link indicates it is possible for virtualization to be disabled: support.apple.com/en-us/HT203296 – zundi Apr 7 '17 at 15:24
  • 2
    I see VMX in my output, but still get errors from Android Studio saying /dev/kvm is not found – IgorGanapolsky Jul 6 '17 at 13:19
  • @zundi, the linked Apple document was modified after I wrote this answer, and is one reason why quoting of relevant parts should be included in an answer. While the latest version of the document contradicts what it once said I think the relevance here is the latest system in that document an Xserve (Early 2009) and 7 years later when this answer was written the then current Macs did not have the issue and in particular the one mentioned in the OP, MacBook Pro (Retina, 13-inch, Early 2015). The document now states in red text "This article has been archived and is no longer updated by Apple." – user3439894 Mar 15 '19 at 22:49
  • @IgorGanapolsky, I fail to see the relevance between "Android Studio saying /dev/kvm is not found" and whether of not VT-x is enabled. That said, without knowing the model and CPU I can only say the issue lies with Android Studio. – user3439894 Mar 15 '19 at 22:51
0

While the answer by @user3439894 indicates that the mac firmware should set VMX on during boot it doesn't in either my 2013 or 2014 MBP. This means that Hyper-V (in bootcamp) does not work without a fix.

To tell if vmx is actually enabled you need to check the 0x3a CPU register - see Activating the Intel VT Virtualization Feature. This can only be done using RDMSR which requires kernel level permissions.

If the EFI is not setting this correctly then the easiest way is to fix this is using rEFInd and set enable_and_lock_vmx in refind.conf to 1

When set to true or a synonym, enable the CPU's VMX bit and lock the MSR. This configuration is necessary for some hypervisors (notably Microsoft's Hyper-V) to function properly. Activating it on other CPUs will, at best, have no effect, and could conceivably crash the computer, so enable it at your own risk!

If your firmware supports activating these features, you should use it instead; this option is provided for users whose firmware does not provide this functionality. (Many Macs lack this configurability, for instance.) The default is false.

This works like this (taken from rEFInd source but can be compiled separately).

#include "../include/tiano_includes.h"

static VOID DoEnableAndLockVMX(VOID)
{
    UINT32 msr = 0x3a;
    UINT32 low_bits = 0, high_bits = 0;

    // is VMX active ?
    __asm__ volatile ("rdmsr" : "=a" (low_bits), "=d" (high_bits) : "c" (msr));

    // enable and lock vmx if not locked
    if ((low_bits & 1) == 0) {
        high_bits = 0;
        low_bits = 0x05;
        msr = 0x3a;
        __asm__ volatile ("wrmsr" : : "c" (msr), "a" (low_bits), "d" (high_bits));
    }
} // VOID DoEnableAndLockVMX()

EFI_STATUS
EFIAPI
efi_main (
  IN EFI_HANDLE        ImageHandle,
  IN EFI_SYSTEM_TABLE  *SystemTable
  )
{
  DoEnableAndLockVMX();

  return EFI_SUCCESS;
}
| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .