in MAC, Uncategorized

[Note] Turn on/off MAC WIFI by Command line

我的 MACbook 如果同時開放 WIFI 和 Bluetooth 時,如果離開 Bluetooth touchpad 會自動斷線。但如果這時候靠近時, Bluetooth 會怎麼樣都連不上,包括開關 Bluetooth ,感覺 Bluetooth & WIFI 會相衝。

這時只剩下一個解法,就是把 WIFI 關掉,這時 Bluetooth 會馬上連上我的 touchpad 。但因為螢幕闔起來了,沒有滑鼠 or touchpad ,只剩下外接鍵盤可用。上網找了一下,發現下面的指令可以直接關掉 WIFI。

$ alias wifioff='networksetup -setairportpower airport off'
$ alias wifion='networksetup -setairportpower airport on'

$ wifioff
airport is not a Wi-Fi interface.
Turning off the only airport interface found: en0

$ wifion
airport is not a Wi-Fi interface.
Turning on the only airport interface found: en0

Reference:
* Enable and Disable AirPort Wireless from the Command Line in Mac OS X

Write a Comment

Comment