Birds Like Wires

Feed the Birds

Command Line Wireless Options in OS X

Managing OS X wireless options was a terrible mystery until I discovered the magical hidden ‘airport’ command. If you do any Mac sysadmin work, I recommend:

sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport /usr/sbin/airport

This gives you lovely, straightforward access to the airport command, from which you can turn wifi on and off, configure administrative settings; basically everything you need. However, watch out; there’s been a change in the version currently shipping in Mavericks. My fave command was:

sudo airport en1 prefs RequireAdmin=YES

But this will no longer work. Instead you receive this response:

'Unrecognized prefs option 'RequireAdmin=YES'.

It’s not a problem, because Apple have actually unpacked the RequireAdmin option into it’s three constituent parts; RequireAdminIBSS, RequireAdminNetworkChange and RequireAdminPowerToggle. You can now control each of them individually.

So my favourite command has now become:

sudo airport en1 prefs RequireAdminIBSS=YES RequireAdminNetworkChange=YES RequireAdminPowerToggle=YES

Followed by a quick:

sudo networksetup -setairportpower en1 off

Which reminds me; if you’re on a Mac Pro and have two ethernet ports, your wifi will likely be en2 instead of en1, but to be sure you can always issue a quick:

networksetup -listallhardwareports

That’s a handy command in itself.

← Recent Articles