See a List of All Wi-Fi Networks a Mac Has Previously Connected To

Dec 21, 2012 - 2 Comments

Wi-Fi Knowing which wireless networks a Mac has been connected to in the past be can be helpful for a variety of reasons, including network troubleshooting, determining where a Mac has been, if a specific wifi password is recoverable, and a myriad of other technical reasons. Searching for past networks is completely different from finding currently available networks, and you won’t recover historical data from the menu bar item or otherwise excellent OS X wi-fi scanner tool. We’ll cover two simple ways to find this information, the first is the easy route through System Preferences, and the second approach uses a lengthy command line string to read the wireless networks from a plist file.

Keep in mind these lists aren’t completely infallible and shouldn’t be considered forensic by any stretch, someone can manually add and remove entries from the preferred and remembered networks lists if they wanted to. Nonetheless, for the average use case troubleshooting scenario they should be adequate.

Seeing Which Wi-Fi Networks a Mac has Connected To Before

If you’ve tweaked your preferred networks before, you’ll be familiar with this list:

  • Open System Preferences from the  Apple menu and choose “Network”
  • Click the “Advanced” button and choose the “Wi-Fi” tab
  • Look under the “Preferred Networks” list to find the list of previously connected wireless networks, it is scrollable

List of past wi-fi networks

The UI approach is easy, but the same information can be retrieved from the command line as well.

List Previously Used Wi-Fi Networks from the Command Line

A wireless network history list can be retrieved by command line through the use of this lengthy string, be sure it is entered onto a single line:

defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences RememberedNetworks | egrep -o '(SSID_STR|_timeStamp).+' | sed 's/^.*= \(.*\);$/\1/' | sed 's/^"\(.*\)"$/\1/' | sed 's/\([0-9]\{4\}-..-..\).*/\1/'

You will see something like so as the output, with only the SSID of routers listed:

This-Router
linksys
CoffeeHouse
RouterFromDubiousLocationThatMacShouldntHaveBeenAt
Starbucks Cupertino
Ancient_Router_from_2007

The long command comes from CoderWall and though it may look strange, it’s required to get clean output. Entering the string without grep and sed will provide you with far more information than you are looking for in this case, as it it dumps out everything pertaining to past wi-fi connections that have become part of the “RememberedNetworks” list.

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: William Pearson in Command Line, Mac OS X, Tips & Tricks

2 Comments

» Comments RSS Feed

  1. Lauri Ranta says:

    I don’t know what the last sed command does (I only had one network), but the grep and sed commands might be combined:

    defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist RememberedNetworks | sed -En 's/^ +"(SSID_STR|_timeStamp)" = "(.+)";/\2/p'

  2. kb says:

    defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences KnownNetworks | sed -En ‘s/^ +”(SSID_STR|_timeStamp)” = “(.+)”;/\2/p’

    For me it is „KnownNetworks“ instead of „RememberedNetworks“, probably because I am still on MacOSX 10.6.8

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