Test Wireless Signal Strength from the Command Line

Jul 7, 2010 - 4 Comments

If you’re trying to tweak a wireless router to get the best signal, being able to continuously measure the signal strength while you toy with the antennas, placement, and whatever else is really valuable. Here’s a way you can do this through the command line using the airport wireless tool we’ve discussed in the past:

To see a running tally of signal strength use the following command:
while x=1; do /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep CtlRSSI; sleep 0.5; done

You’ll see something like ‘agrCtlRSSI: -38′ with the last number changing frequently, but printed repeatedly on your terminal screen. You can stop this command from refreshing by hitting Control+C.

To report just a single line with signal strength, use the following:
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. I found both of above code samples on MacOSXHints and they’ve been a big help when trying to position my hardware for maximum reception quality.

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

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