-
-
Save rtgibbons/2024307 to your computer and use it in GitHub Desktop.
Script: reload VirtualBox kernel extension in Mac OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
unload() { | |
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() { | |
sudo kextload /Library/Extensions/VBoxDrv.kext -r /Library/Extensions/ | |
sudo kextload /Library/Extensions/VBoxNetFlt.kext -r /Library/Extensions/ | |
sudo kextload /Library/Extensions/VBoxNetAdp.kext -r /Library/Extensions/ | |
sudo kextload /Library/Extensions/VBoxUSB.kext -r /Library/Extensions/ | |
} | |
case "$1" in | |
unload|remove) | |
unload | |
;; | |
load) | |
load | |
;; | |
*|reload) | |
unload | |
load | |
;; | |
esac |
Updated script for the latest versions of VirtualBox on OSX
#!/bin/bash
unload() {
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() {
sudo kextload "/Library/Application Support/VirtualBox/VBoxDrv.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/VBoxNetAdp.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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool. Note that the kexts have been moved for the last versions of VirtualBox (or perhaps because of Mavericks, dunno). In any case, they are now under "/Library/Application Support/VirtualBox/"