I'm unable to find info on how to use networksetup or some other tool on OS X that will allow me to disassociate/leave a WiFi network without turning off AirPort or removing the preferred networks list.

When the Mac hasn't joined any networks but WiFi is on, it is precisely in this state, but I need to know how to trigger this on the command line.

link|improve this question
feedback

migrated from stackoverflow.com Feb 9 at 21:04

This question came from our site for professional and enthusiast programmers.

1 Answer

Apple includes a command line utility to change AirPort settings, called airport.

sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z

The -z option will disassociate from any network. If you use that command often, you can link it to a directory that's in your PATH, for example /usr/bin.

sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/bin/airport

After this, you'll only have to call:

airport
link|improve this answer
Thank you slhck! Worked like a charm! – Мартин Насковски Feb 10 at 11:04
feedback

Your Answer

 
or
required, but never shown

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