Test Wireless Signal Strength from Command Line of Mac OS X

Jul 7, 2010 - 4 Comments

Terminal in OS X If you’re trying to tweak a wireless router to get the best signal, being able to continuously measure the wi-fi signal strength while you toy with the antennas, placement, and whatever else on the network is really valuable. While most users are best served by using the Mac Wi-Fi Diagnostics app to monitor signal strength and performance, another option is to turn to the command line of OS X, and that’s what we’re going to cover here.

This trick is based entirely from the command line using the somewhat secretive airport wireless tool, and it’s available on all Macs with all versions of OS X. Yes the airport tool is still around and as useful as ever, even though wireless networking is now called Wi-Fi on the Mac.


Open the Terminal app to get started. For best results, you’ll probably want to increase the text size of your terminal font, the Command+ keystroke makes that easy.

How to Monitor Wi-Fi Signal Strength from Command Line on Mac OS X and View RSSI History

To see a running tally of signal strength use the following command, be sure the syntax is entered properly with no linebreaks (wrapping is ok) for this to function as intended:

while x=1; do /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep CtlRSSI; sleep 0.5; done

Hit return and you’ll start to see something like the following scrolling on screen:

agrCtlRSSI: -46
agrCtlRSSI: -48
agrCtlRSSI: -38
agrCtlRSSI: -44

This is your signal strength indicator, you’ll notice the last number of ‘agrCtlRSSI: -38′ should be changing frequently as it is printed repeatedly on your terminal screen. That number is the strength of your wi-fi signal coming from the router to your Mac.

You can stop this continuous signal monitoring command from refreshing by hitting Control+C at the Terminal window.

Monitor Wi-Fi Signal Strength from Command Line of Mac OS X

Watching Wi-Fi Signal Strength on a Single Line in OS X Terminal

If you don’t want to see a list of wireless signal strength with history (which makes it easy to tell if your adjustments are making things better or worse), you can also have the command report just a single line with signal strength. This can be helpful for scripting and customizing your shell, and may be preferential to some users in general. To have a single line of text, use the following syntax:

clear; while x=1; do /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep CtlRSSI | sed -e 's/^.*://g' | xargs -I SIGNAL printf "\rRSSI dBm: SIGNAL"; sleep 0.5; done

Again just hit Control+C to stop the command.

It’s worth remembering that wi-fi signal strength is impacted by many factors, including the power of the wireless router antenna, interference from local items and physical barriers like a chimney or microwave, radio signals, and much more. For best results, you’ll want to be sure you have chosen the best wi-fi channel for your network, easily possible with this Mac utility, so that the wi-fi broadcast channel has minimal nearby usage and interference.

I found both of above code samples on a long-gone forum page when searching for a way to do monitor signal strength, this was before the days of the Mac OS X Wireless Diagnostics Tool natively including such functionality, and they’ve been a big help when trying to position my wi-fi hardware for maximum reception quality. This command line approach works in all vaguely modern versions of Mac system software, and it’s still around in the latest releases too.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: David Mendez in Command Line, Mac OS X, Tips & Tricks

4 Comments

» Comments RSS Feed

  1. Asher says:

    If you use this one often, you might want to symlink it as follows…

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

    …so that “airport” is now symlinked into a directory within your $path, so subsequently instead of having to type out the full path, you can simply type e.g. “airport -I”

  2. Robert says:

    Does anyone know how you can get the signal strength of an iPhone connected to a WiFi network? If I open Airport Utility and look under: /Advanced/Logs and Statistics/Wireless Clients/ it shows me signal strength of clients connected to network, any way to get at this from command line? Thanks. :]

  3. Sam says:

    There’s another handy way to use this script:

    while x=1; do /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep CtlRSSI | sed -e ‘s/^.*://g’ | say ; sleep 1; done

    This will let my macbook read the signal strength out loud, while I’m tweaking the antenna in the other room ;-)

    Thanks!

  4. sdb says:

    Instead of:
    while x=1; do …

    should do:
    while true; do …

    Avoids confusing the issue with an unnecessary variable.

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates