How to control AirPort wireless radio from the command line?
I want to know how to control (specifically turn off) the networking (specifically AirPort - I want to turn off the radio) from the command line (specifically from bash in Terminal.app, being run by me) as a user (no sudo privileges or admin priviliges). You CAN turn off AirPort as a user, but I need to do this from the command line – as a user.
Solution 1:
See OSX Daily - Enable and Disable AirPort Wireless from the Command Line in Mac OS X. Quote:
Turn Airport Off via Command Line
networksetup -setairportpower airport off
Turn Airport On via Command Line
networksetup -setairportpower airport on
You won’t see any confirmation in the Terminal that the command succeeded or failed, but if you watch the AirPort menu icon you will see the bars disappear indicating the wireless interface is turned off, or reappear indicating that wireless is activated again.
NOTE: In OS X Lion, use the hardware name above instead of airport
,
e.g. networksetup -setairportpower en1 off
.