Skip to content

Instantly share code, notes, and snippets.

@jonseymour jonseymour/reload-vbox.sh
Last active Jan 28, 2016

Embed
What would you like to do?
Reload the Mac OSX Kernel Extensions for Official VirtualBox Distribution
#!/usr/bin/env bash
# based on https://gist.github.com/rtgibbons/2024307 with updates from comments of that gist for OSX 10.9
EXTDIR="/Library/Application Support/VirtualBox"
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 "$EXTDIR/VBoxDrv.kext" -r "$EXTDIR"
sudo kextload "$EXTDIR/VBoxNetFlt.kext" -r "$EXTDIR"
sudo kextload "$EXTDIR/VBoxNetAdp.kext" -r "$EXTDIR"
sudo kextload "$EXTDIR/VBoxUSB.kext" -r "$EXTDIR"
}
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
You can’t perform that action at this time.