Reply to comment

Control AirPort with the Command Line

For some reason my WiFi on my MacBook keeps flaking out and I have to disconnect and reconnect to the access point to restore the connection. I managed to write a simple shell script to do this, and I can run the script easily with QuickSilver or through Spotlight.

First do the following to create a symlink to the airport binary, which lets you control AirPort from the command line/terminal.

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

Next, open TextEdit and insert the following:

#!/bin/bash
sudo airport -z
sudo airport --associate=SSID --bssid=SSID --password=PASSWORD

Save that in your home directory; I call mine toggleap.

Finally, open Terminal and execute:

chmod +x toggleap

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options