如何在 Mac 上bluetooth
通过terminal
/ shell
/ automator
/关闭?applescript
这应该很容易。
顺便说一句,我知道你可以让 applescript 按bluetooth
菜单然后按turn bluetooth off
。如果可能的话,我不想要这个。
如何在 Mac 上bluetooth
通过terminal
/ shell
/ automator
/关闭?applescript
这应该很容易。
顺便说一句,我知道你可以让 applescript 按bluetooth
菜单然后按turn bluetooth off
。如果可能的话,我不想要这个。
我将使用blueutil。
-- 小工具mo
有两种方法可以解决。您可以告诉launchd
卸载蓝牙守护程序并且不再按需启动它,或者您可以以编程方式切换它的首选项并停止服务器。
对于前一种方法,使用launchctl
to telllaunchd
卸载守护程序并设置其禁用标志:
# launchctl unload -w /System/Library/LaunchDaemons/com.apple.blued.plist
如果您想稍后恢复它,这应该足够了:
# launchctl load -wF /System/Library/LaunchDaemons/com.apple.blued.plist
那应该这样做。现在对于后一种方法,首先更新首选项文件(从 UI 切换时会发生同样的事情):
# defaults write /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState -BOOL 0
然后,您可以粗鲁地关闭服务器:
# killall blued
稍后,您可以通过重置该位来恢复首选项:
# defaults write /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState -BOOL 1
然后 kick launchd 让它blued
再次启动:
# launchctl start com.apple.blued