Homebrew-cask: Cannot install virtualbox on macOS High Sierra

Created on 6 Oct 2017  Â·  5Comments  Â·  Source: Homebrew/homebrew-cask

General troubleshooting steps

Description of issue

Installation of virtualbox fails:

==> Failed command:

/usr/bin/sudo -E -- /usr/sbin/installer -pkg /usr/local/Caskroom/virtualbox/5.1.28-117968/VirtualBox.pkg -target /

==> Standard Output of failed command:

installer: Package name is Oracle VM VirtualBox
installer: Installing at base path /
installer: The install failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.)

==> Standard Error of failed command:

==> Exit status of failed command:

#<Process::Status: pid 46701 exit 1>

==> Exit status of failed command:

Output of your command with --verbose --debug

brew cask install virtualbox --verbose --debug
==> Hbc::Installer#install
==> Printing caveats
==> Hbc::Installer#fetch
==> Satisfying dependencies
==> Downloading
==> Downloading http://download.virtualbox.org/virtualbox/5.1.28/VirtualBox-5.1.28-117968-OSX.dmg
Already downloaded: /Users/brendan/Library/Caches/Homebrew/Cask/virtualbox--5.1.28-117968.dmg
==> Downloaded to -> /Users/brendan/Library/Caches/Homebrew/Cask/virtualbox--5.1.28-117968.dmg
==> Verifying download
==> Determining which verifications to run for Cask virtualbox
==> Checking for verification class Hbc::Verify::Checksum
==> 1 verifications defined
Hbc::Verify::Checksum
==> Running verification of class Hbc::Verify::Checksum
==> Verifying checksum for Cask virtualbox
==> SHA256 checksums match
==> Installing Cask virtualbox
==> Hbc::Installer#stage
==> Extracting primary container
==> Determining which containers to use based on filetype
==> Checking container class Hbc::Container::Pkg
==> Checking container class Hbc::Container::Ttf
==> Checking container class Hbc::Container::Otf
==> Checking container class Hbc::Container::Air
==> Checking container class Hbc::Container::Cab
==> Checking container class Hbc::Container::Dmg
==> Executing: ["/usr/bin/hdiutil", "imageinfo", "/Users/brendan/Library/Caches/Homebrew/Cask/virtualbox--5.1.28-117968.dmg"]
==> Using container class Hbc::Container::Dmg for /Users/brendan/Library/Caches/Homebrew/Cask/virtualbox--5.1.28-117968.dmg
==> Executing: ["/usr/bin/hdiutil", "attach", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", "/var/folders/5n/nh5zvs2x069d9dgkp9zn1vpr0000gn/T/d20171006-46769-sdkadb", "/Users/brendan/Library/Caches/Homebrew/Cask/virtualbox--5.1.28-117968.dmg"]
==> Executing: ["/usr/bin/mkbom", "-s", "-i", "/var/folders/5n/nh5zvs2x069d9dgkp9zn1vpr0000gn/T/20171006-46769-18qia42.list", "--", "/var/folders/5n/nh5zvs2x069d9dgkp9zn1vpr0000gn/T/20171006-46769-1adlsha.bom"]
==> Executing: ["/usr/bin/ditto", "--bom", "/var/folders/5n/nh5zvs2x069d9dgkp9zn1vpr0000gn/T/20171006-46769-1adlsha.bom", "--", "/private/var/folders/5n/nh5zvs2x069d9dgkp9zn1vpr0000gn/T/d20171006-46769-sdkadb/dmg.VfUG9R", "/usr/local/Caskroom/virtualbox/5.1.28-117968"]
==> Executing: ["/usr/sbin/diskutil", "eject", "/private/var/folders/5n/nh5zvs2x069d9dgkp9zn1vpr0000gn/T/d20171006-46769-sdkadb/dmg.VfUG9R"]
==> Creating metadata directory /usr/local/Caskroom/virtualbox/.metadata/5.1.28-117968/20171006121617.383.
==> Creating metadata subdirectory /usr/local/Caskroom/virtualbox/.metadata/5.1.28-117968/20171006121617.383/Casks.
==> Installing artifacts
==> Determining which artifacts are present in Cask virtualbox
==> 4 artifact/s defined
uninstall_preflight (Preflight Block)
:script => [:executable, "VirtualBox_Uninstall.tool"], :script => [:args, ["--unattended"]], :script => [:sudo, true], :pkgutil => "org.virtualbox.pkg.*" (Uninstall)
VirtualBox.pkg (Pkg)
:delete => "/Library/Application Support/VirtualBox", :delete => "~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.virtualbox.app.virtualbox.sfl", :delete => "~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.virtualbox.app.virtualboxvm.sfl", :delete => "~/Library/VirtualBox", :delete => "~/Library/Preferences/org.virtualbox.app.VirtualBox.plist", :delete => "~/Library/Preferences/org.virtualbox.app.VirtualBoxVM.plist", :delete => "~/Library/Saved Application State/org.virtualbox.app.VirtualBox.savedState", :delete => "~/Library/Saved Application State/org.virtualbox.app.VirtualBoxVM.savedState", :rmdir => "~/VirtualBox VMs" (Zap)
==> Installing artifact of class Hbc::Artifact::PreflightBlock
==> Installing artifact of class Hbc::Artifact::Pkg
==> Running installer for virtualbox; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
==> Executing: ["/usr/bin/sudo", "-E", "--", "/usr/sbin/installer", "-pkg", "/usr/local/Caskroom/virtualbox/5.1.28-117968/VirtualBox.pkg", "-target", "/", "-verboseR"]
==> installer: Package name is Oracle VM VirtualBox
==> installer: Installing at base path /
==> installer:PHASE:Preparing for installation…
==> installer:PHASE:Preparing the disk…
==> installer:PHASE:Preparing Oracle VM VirtualBox…
==> installer:PHASE:Waiting for other installations to complete…
==> installer:PHASE:Configuring the installation…
==> installer:STATUS:
==> installer:%13.829789
==> installer:PHASE:Writing files…
==> installer:%64.681396
==> installer:PHASE:Moving items into place…
==> installer:%86.784895
==> installer:PHASE:Running package scripts…
==> installer:PHASE:Validating packages…
==> installer:%97.750000
==> installer: The install failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.)
==> Reverting installation of artifact of class Hbc::Artifact::PreflightBlock
==> Purging files for version 5.1.28-117968 of Cask virtualbox
Error: Command failed to execute!

==> Failed command:
/usr/bin/sudo -E -- /usr/sbin/installer -pkg /usr/local/Caskroom/virtualbox/5.1.28-117968/VirtualBox.pkg -target / -verboseR

==> Standard Output of failed command:
installer: Package name is Oracle VM VirtualBox
installer: Installing at base path /
installer:PHASE:Preparing for installation…
installer:PHASE:Preparing the disk…
installer:PHASE:Preparing Oracle VM VirtualBox…
installer:PHASE:Waiting for other installations to complete…
installer:PHASE:Configuring the installation…
installer:STATUS:
installer:%13.829789
installer:PHASE:Writing files…
installer:%64.681396
installer:PHASE:Moving items into place…
installer:%86.784895
installer:PHASE:Running package scripts…
installer:PHASE:Validating packages…
installer:%97.750000
installer: The install failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.)


==> Standard Error of failed command:


==> Exit status of failed command:
#<Process::Status: pid 46918 exit 1>

/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/system_command.rb:65:in `assert_success'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/system_command.rb:36:in `run!'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/system_command.rb:14:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/system_command.rb:18:in `run!'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/pkg.rb:53:in `block in run_installer'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/pkg.rb:59:in `with_choices_file'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/pkg.rb:51:in `run_installer'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/pkg.rb:32:in `install_phase'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:191:in `block in install_artifacts'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:183:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:183:in `install_artifacts'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:97:in `install'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:19:in `block in run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:13:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:13:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb:35:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:97:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:167:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:131:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:99:in `<main>'
Error: Kernel.exit
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:172:in `exit'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:172:in `rescue in run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:155:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:131:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:99:in `<main>'

Output of brew cask doctor

brew doctor
Your system is ready to brew.

Most helpful comment

Leaving this here for others - the solutions above do not work because there are a number of kexts to approve - you may have to do the cycle many times... or use this handy dandy script:

#!/bin/bash

unload() {
        if [ `ps -ef | grep -c VirtualBox$` -ne 0 ]
        then
                echo "VirtualBox still seems to be running. Please investigate!!"
                exit 1;
        elif [ `ps -ef | grep -c [V]ir` -gt 0 ]
        then
                echo "Stopping running processes before unloading Kernel Extensions"
                ps -ef | grep [V]ir | awk '{print $2}' | xargs kill
        fi
        echo "Unloading Kernel Extensions"
        kextstat | grep "org.virtualbox.kext.VBoxUSB" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxUSB
        kextstat | grep "org.virtualbox.kext.VBoxNetFlt" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetFlt
        kextstat | grep "org.virtualbox.kext.VBoxNetAdp" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetAdp
        kextstat | grep "org.virtualbox.kext.VBoxDrv" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxDrv
}

load() {
        echo "Loading Kernel Extentions"
        sudo kextload "/Library/Application Support/VirtualBox/VBoxDrv.kext" -r "/Library/Application Support/VirtualBox/"
        sudo kextload "/Library/Application Support/VirtualBox/VBoxNetAdp.kext" -r "/Library/Application Support/VirtualBox/"
        sudo kextload "/Library/Application Support/VirtualBox/VBoxNetFlt.kext" -r "/Library/Application Support/VirtualBox/"
        sudo kextload "/Library/Application Support/VirtualBox/VBoxUSB.kext" -r "/Library/Application Support/VirtualBox/"
}

case "$1" in
        unload|remove)
                unload
                ;;
        load)
                load
                ;;
        *|reload)
                unload
                load
                ;;
esac

Run this script after you attempt to install virtualbox. Keep approving the kexts until the script runs cleanly:
tn2459_approval

THEN run brew cask reinstall --force virtualbox

All 5 comments

This is a macOS issue because of secure kext loading in High Sierra.

Follow the instructions here to enable the virtualbox kext and run:
brew cask install --force virtualbox

Thanks. That got me onto the right path. For some reason install didn't work as you have it above, but reinstall did:

brew cask reinstall --force virtualbox --verbose --debug

Thanks again.

Leaving this here for others - the solutions above do not work because there are a number of kexts to approve - you may have to do the cycle many times... or use this handy dandy script:

#!/bin/bash

unload() {
        if [ `ps -ef | grep -c VirtualBox$` -ne 0 ]
        then
                echo "VirtualBox still seems to be running. Please investigate!!"
                exit 1;
        elif [ `ps -ef | grep -c [V]ir` -gt 0 ]
        then
                echo "Stopping running processes before unloading Kernel Extensions"
                ps -ef | grep [V]ir | awk '{print $2}' | xargs kill
        fi
        echo "Unloading Kernel Extensions"
        kextstat | grep "org.virtualbox.kext.VBoxUSB" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxUSB
        kextstat | grep "org.virtualbox.kext.VBoxNetFlt" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetFlt
        kextstat | grep "org.virtualbox.kext.VBoxNetAdp" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetAdp
        kextstat | grep "org.virtualbox.kext.VBoxDrv" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxDrv
}

load() {
        echo "Loading Kernel Extentions"
        sudo kextload "/Library/Application Support/VirtualBox/VBoxDrv.kext" -r "/Library/Application Support/VirtualBox/"
        sudo kextload "/Library/Application Support/VirtualBox/VBoxNetAdp.kext" -r "/Library/Application Support/VirtualBox/"
        sudo kextload "/Library/Application Support/VirtualBox/VBoxNetFlt.kext" -r "/Library/Application Support/VirtualBox/"
        sudo kextload "/Library/Application Support/VirtualBox/VBoxUSB.kext" -r "/Library/Application Support/VirtualBox/"
}

case "$1" in
        unload|remove)
                unload
                ;;
        load)
                load
                ;;
        *|reload)
                unload
                load
                ;;
esac

Run this script after you attempt to install virtualbox. Keep approving the kexts until the script runs cleanly:
tn2459_approval

THEN run brew cask reinstall --force virtualbox

@dstroot you sir, are a lifesaver. Thank you so much for this. I was able to finally install Virtualbox this way.

Please don't post instructions for disabling SIP.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tycm picture tycm  Â·  3Comments

mmoehring picture mmoehring  Â·  3Comments

jrwiegand picture jrwiegand  Â·  3Comments

my2ter picture my2ter  Â·  4Comments

gebing picture gebing  Â·  3Comments