Fixing ‘The Installation Failed’ VirtualBox Error on Mac High Sierra

When installing VirtualBox on Mac High Sierra, the ‘Installation Failed’ error can be quite stubborn. Let’s fix that.

Introduction

A colleague had some trouble installing VirtualBox on macOS High Sierra v10.13.5. Here’s the error he kept encountering:

‘The installer encountered an error that caused the installation to fail’ — a very helpful error message

We scoured the web for solutions before finally figuring it out.

Finding a solution wasn’t as easy as we’d hoped, so hopefully our findings below will help out anyone who ran into the same stubborn error that we did.

Check this first

  1. Open up System Preferences
  2. Click on theSecurity & Privacy icon
  3. Make sure Allow apps downloaded from: App store and identified developers is checked.

It should look like this:

Make sure ‘App store and identified developers’ is checked

If your screen doesn’t look like that:

  1. Click the lock icon in the bottom left of the window
  2. Enter your Mac password
  3. Click App store and identified developers
  4. Try to install VirtualBox again

If you get the same error, try solution 1.

Solution #1 — Quick and easy

If you’re lucky, this solution will work first time.

  1. Open up System Preferences
  2. Click on theSecurity & Privacy icon
  3. Hopefully you’ll see a message saying System software from developer “Oracle America, Inc.” was blocked from loading.
  4. If you do see the message, click the lock icon in the bottom left of the window
  5. Enter your Mac password
  6. Then click the Allow button

Done! Now open up the VirtualBox installer again and it should work fine.

If only it were always this simple… If the Allow button didn’t come up for you, try out the next one.

Solution #2 — Back to basics

Sometimes macOS needs a good restart before deciding to show the Allow button. So here’s what we’ll do:

  1. Restart your Mac
  2. Open up the VirtualBox installer
  3. Go through the installer until you get to the screen with the Change Install Location… and Install buttons. Do not click install (yet)
  4. Open up System Preferences
  5. Click on theSecurity & Privacy icon
  6. Hopefully you’ll see a message saying System software from developer “Oracle America, Inc.” was blocked from loading.
  7. If you do see the message, click the lock icon in the bottom left of the window
  8. Enter your Mac password
  9. Then click the Allow button

Done! If the message and the Allow button still didn’t appear, we’ll have to resort to drastic measures with solution #3:

Solution #3 — Force macOS to let us install VirtualBox

To force macOS to let us install VirtualBox, we’ll need to use Terminal to open up our security preferences temporarily:

  1. Do CMD + SPACE to open up Spotlight
  2. Type inTerminal and press ENTER to open up Terminal
  3. Now let’s temporarily disable Mac Gatekeeper. 
    Type the following into Terminal:
    sudo spctl --master-disable
  4. Press ENTER
  5. Now type in the password for your Mac account. Don’t worry if it looks like your password isn’t being typed: Mac hides the input for security
  6. Press ENTER

Done! Next we need to restart System Preferences:

  1. Make sure System Preferences is open
  2. Hold down the Option key ⌥ and right-click System Preferences in the Dock
  3. Click Force Quit
  4. Now open up System Preferences again
  5. Click on theSecurity & Privacy icon

Below Allow apps downloaded from: you should now see a third option which is already selected: Anywhere

A third option has appeared: Anywhere

Great! Now one of either two things should happen:

  1. The Allow button has already appeared: just click Allow and install VirtualBox. Everything should work smoothly
  2. The Allow button has not appeared yet: don’t worry. Try to install VirtualBox. It should just work or you should see the Allow button appear.
Warning: we have not re-enabled app installation security yet. Make sure to complete the app installation security section below so your Mac isn’t left unprotected!

If you don’t see the third option ‘Anywhere’ appear

You may need to run the sudo spctl — master-disable command again and then restart System Preferences. One person online said it took 5 attempts to get the command to work for them. Keep trying.

Worst case scenario: restart your Mac and try again.

⚠️ Important: Re-enabling app installation security on your Mac

If you’ve attempted Solution #3, you must follow this section to ensure your Mac is secure:

  1. Open up Terminal again
  2. Enter the command below:
    sudo spctl --master-enable
  3. Press ENTER
  4. Now type in the password for your Mac account. Don’t worry if it looks like your password isn’t being typed: Mac hides the input for security
  5. Press ENTER

Done! Now you should be able to install VirtualBox fine and your Mac is secure!

If you want to check that it worked, you’ll have to restart System Preferences again. Afterwards, you should no longer see the Anywhere option in Security & Privacy.

I hope this has helped! If you have any trouble with this, please post in the comments below. I’ll do my best to help.

🌏 2019 Update: a couple of things to try if you’re stuck

If you’ve tried all of the above but VirtualBox still refuses to install, the kind commenters Leo Shaw and Elias Politakis have got your back.

They’ve posted a couple of extra fixes in the comments below:

  • Have a look here if you can’t click the ‘Allow’ button
  • Read through the information here if you’re using a VNC connection

Good luck (and happy virtualbox-ing)! :)