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.


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:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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