Skip to content

Instantly share code, notes, and snippets.

@kumekay
Forked from pierot/gist:2762217
Last active August 29, 2015 14:12
Show Gist options
  • Save kumekay/c91c8b6e0907f140454b to your computer and use it in GitHub Desktop.
Save kumekay/c91c8b6e0907f140454b to your computer and use it in GitHub Desktop.
--Bluetooth for VirtualBox
--delay 5
set question to display dialog "Manage Bluetooth for ... " buttons {"VirtualBox", "Cancel", "Mac OS"} default button "Cancel" cancel button "Cancel" with icon caution with title "Bluetooth" giving up after 30
set answer to button returned of question
if answer is equal to "VirtualBox" then
-- delay 30
try
do shell script "launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist"
delay 5
end try
try
do shell script "sudo kextunload -b com.apple.driver.BroadcomUSBBluetoothHCIController" password "secretols" with administrator privileges
delay 5
end try
try
do shell script "sudo kextunload -b com.apple.driver.AppleUSBBluetoothHCIController" password "secretols" with administrator privileges
delay 5
end try
try
do shell script "sudo kextunload -b com.apple.iokit.IOBluetoothSerialManager" password "secretols" with administrator privileges
end try
else if answer is equal to "Mac OS" then
-- delay 30
try
do shell script "sudo kextload -b com.apple.iokit.IOBluetoothSerialManager" password "secretols" with administrator privileges
delay 5
end try
try
do shell script "sudo kextload -b com.apple.driver.AppleUSBBluetoothHCIController" password "secretols" with administrator privileges
delay 5
end try
try
do shell script "sudo kextload -b com.apple.driver.BroadcomUSBBluetoothHCIController" password "secretols" with administrator privileges
delay 5
end try
try
do shell script "launchctl load /System/Library/LaunchDaemons/com.apple.blued.plist"
end try
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment