Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 7 down vote accepted

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.

share|improve this answer
2  
This a great answer, but you should specify that they need to replace airport with the network adapter name their computer uses. For my MacBook Pro, it's en1. –  CajunLuke Mar 31 '12 at 0:54
    
Great point. The article I quoted to even had a similar comment. –  Chris W. Rea Mar 31 '12 at 1:10
    
Thank you! This was very helpful, a friend of mine is on a computer where when you try to change airport to off it pops something up for the admin password. This seemed easier than fixing that - now he has two workflows for connecting automatically to various networks at times of the day and stuff like that. –  Andrew Mar 31 '12 at 2:42
2  
Beware that it is not always en1. To find out what it is on your computer, you can use either networksetup -listallhardwareports or ifconfig. –  mhucka Nov 20 '12 at 1:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.