¿Cómo puedo activar el bluetooth a través del terminal / la línea de comandos?
Respuesta
¿Demasiados anuncios?Hay una respuesta en Superusuario . El último post es el que mejor me ha funcionado, en una forma ligeramente diferente. El 'checkbox "On"' no me funcionó, pero el siguiente código sí:
# This is only necessary, if AppleScripts are not yet allowed to change checkboxes
tell application "System Events" to set UI elements enabled to true
# Now change the bluetooth status
tell application "System Preferences"
set current pane to pane id "com.apple.preferences.bluetooth"
tell application "System Events"
tell process "System Preferences"
# Enabled is checkbox number 2
if value of checkbox 2 of window "Bluetooth" is 0 then
click checkbox 2 of window "Bluetooth"
end if
end tell
end tell
quit
end tell
Puedes ejecutar este script utilizando osascript .
Actualización: Ahora he cambiado el script para que sólo active el Bluetooth. Ya no hay que alternar.