I'm looking for a simple utility that I could configure to a hotkey which would allow me to toggle ON/OFF my Mac's Wi-Fi.

link|improve this question
feedback

5 Answers

Maybe not the easiest but this seems to work: http://problemhercules.blogspot.com/2009/08/how-to-configure-airport-onoff-shortcut.html

link|improve this answer
feedback

Although there seems to be no reliable way of turning AirPort on or off directly via the shell, it is possible to get around that by manipulating OS X's Locations with the scselect command.

First, create a new location called AirPort-Off in the Network preferences pane. With this new location selected, select Network Port Configurations under the Show pop-up menu, and deselect AirPort. Then select your previous location, which for most people would probably be Automatic.

Now, you can turn AirPort off by running scselect AirPort-Off and back on by running the last command, replacing AirPort-Off with the name of your normal location name. To assign a hot key to the command using a utility like Butler, create a simple AppleScript containing this one line:

do shell script "/usr/sbin/scselect AirPort-Off"

Then have Butler (or your app of choice) run that APpleScript. (With Butler, running a shell script containing only the bare command doesn't seem to work.)

link|improve this answer
feedback
up vote 0 down vote accepted

Something like this worked for me.

link|improve this answer
feedback

You could assign a shortcut to a script like this using an app like FastScripts or Alfred:

#!/bin/bash

device="$(networksetup -listallhardwareports |
grep -E '(Wi-Fi|AirPort)' -A 1 | grep -o "en.")"
[[ "$(networksetup -getairportpower $device)" == *On ]] && val=off || val=on
networksetup -setairportpower $device $val

If you use Alfred and have the Powerpack, there's an extension called Toggle wifi on/off that basically just runs a shell script like the one above.

link|improve this answer
feedback

We built Airtoggle exactly for this. It's great for people who don't want to use scripts etc. http://www.axoniclabs.com/Airtoggle/

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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