How to Install VirtualBox in MacOS Mojave if Installation Fails or Shows Kernel Driver Errors
If you have attempted to install VirtualBox in macOS Mojave you may have noticed the installation sometimes fails with a generic “The installation failed” error message. Then, when trying to run VirtualBox you may experience another error saying “Kernel driver not installed” and VirtualBox fails to function. We’ll cover two different resolutions to the installation/running VirtualBox problem, one involving a Gatekeeper bypass, and the other using a Gatekeeper exception (for macOS 10.14.5 or later).
The reason for the installation failure and the inability for the kernel module to load successfully is due to security restrictions in MacOS Mojave, and thus to be able to successfully install VirtualBox and run the app you will need to make a relatively simple bypass of those aforementioned security restrictions (alternatively, you can also disable Gatekeeper completely but that is generally not recommended). By the way, while this article is obviously focused on VirtualBox you will find this same general process is necessary for installing other apps that include kernel extensions.
How to Successfully Install VirtualBox in MacOS Mojave (if it fails)
Assuming you have already downloaded VirtualBox onto the Mac (it’s free to download here), here is how you can successfully install and run VirtualBox in MacOS Mojave:
- Run the VirtualBox installer as usual, you’ll eventually see the “Installation Failed” message
- Quit out of the VirtualBox installer after it fails
- Now pull down the Apple menu and open System Preferences
- Choose “Security & Privacy” and go to the ‘General’ tab within Security preference panel, then click the lock button and enter the administrator password
- At the bottom of the Security General section, look for the message stating “System software from developer ‘Oracle America, Inc’ was blocked from loading” and click the “Allow” button
- Relaunch the VirtualBox installer and proceed through the installation as usual, it should now succeed as expected
Go ahead and run VirtualBox as usual, it should load fine without any further kernel driver error messages. If you are still experiencing issues, refer to the next step, which is a different procedure required in later versions of MacOS.
Can’t Install / Run VirtualBox in MacOS 10.14.5 or Later? Try This
If you’re attempting to install VirtualBox on a machine running macOS Mojave 10.14.5 or later you may run into a notarization requirement for apps outside the App Store. To get around that (for now until VirtualBox becomes notarized) try the following:
- Restart the Mac into Recovery Mode by rebooting and holding down COMMAND + R keys concurrently
- At the “Utilities” screen, pull down the ‘Utilities’ menu and choose “Terminal” to launch terminal from Recovery Mode
- Enter the following command:
- Hit Return, then restart the Mac with a normal boot as usual
spctl kext-consent add VB5E2TV963
This solution was posted in our comments below via VirtualBox forums and appears to work for many users running macOS 10.14.5 or newer (thanks to the various commenters to left this solution!). Apparently “VB5E2TV963” is the code for Oracle, and entering this Gatekeeper exception into the command line will allow VirtualBox to install in the newest versions of MacOS with notarization requirements. This will likely only be a temporary necessity until VirtualBox eventually becomes notarized through the process outlined by Apple.
Now try installing and/or running VirtualBox, it should work fine within the latest versions of MacOS system software.
In the screenshot below you see VirtualBox running in MacOS 10.14.x with BeOS / Haiku OS.
If you’re an advanced user (and you probably are if you’re running virtualization software and virtual machines in the first place) then you might be interested in allowing apps to be installed from anywhere in MacOS by adjusting Gatekeeper as instructed here.
For some quick background, MacOS Mojave 10.14.5 and later versions of MacOS require notarization to be able to install some apps outside the App Store. Additionally, GateKeeper is the Mac OS security mechanism that aims to prevent untrusted apps from being run or installed on the Mac. By default, the more modern versions of MacOS have particularly strict Gatekeeper settings and will throw error messages stating that an app can’t be opened because it is from an unidentified developer and so forth, though simply right-clicking and choosing “Open” on most apps allows you to bypass that mechanism, and you can also bypass that from the Security preference panel too. The newest macOS releases, like Mojave, take this further and also will require app notarization from the developer (or a manual bypass as instructed in the latter tutorial), or a Gatekeeper bypass for installing certain software that bundles kernel extensions as well, such as VirtualBox. If you’re not thrilled with those protective mechanisms to MacOS, you can always disable Gatekeeper completely and disable System Integrity Protection as well, though doing so is generally not recommended.