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

Dec 21, 2012 - 10 Comments


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 Mac OS X wi-fi scanner tool.

We’ll cover two simple ways to find past wi-fi network connections on a Mac, 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.

How to See 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:

  1. Open System Preferences from the  Apple menu and choose “Network”
  2. Click the “Advanced” button and choose the “Wi-Fi” tab
  3. 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.

How to List Previously Used Wi-Fi Networks on Mac 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:

In modern versions of Mac OS, like macOS Mojave, Catalina, Sierra, OS X El Capitan, and Yosemite, you can shorten the syntax considerably as so:

defaults read /Library/Preferences/SystemConfiguration/ |grep SSIDString

In prior versions of Mac OS X, you can opt for the same as the above command, or use the lengthier string below with heavy regex:

defaults read /Library/Preferences/SystemConfiguration/ 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:

Starbucks Cupertino

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.

Prior wi-fi connection history is useful for many reasons, whether to figure out which routers you have used in the past for connectivity, troubleshooting, personal or private reasons, discovering connection history, or even for digital forensics purposes. You can use the command line method or the GUI method, whichever is easiest for you or most applicable for your use case scenario.

If you know of any other method or approach to listing prior wi-fi network connections on a Mac, share with us in the comments below!


Related articles:

Posted by: William Pearson in Command Line, Mac OS, Tips & Tricks


» Comments RSS Feed

  1. Hsu Yao Chang says:

    Would it be possible to delete or hide wifi list ssid?I mean not prefer list, it’s other network list. Thanks.

  2. x says:

    doesn’t work on Big Sur

    defaults read /Library/Preferences/SystemConfiguration/ |grep SSIDString

  3. Niko says:

    This worked perfect for me.

    Had the list of my preferred WLANs erased by hitting a button in CleanMyMac3 – but with your help I found it in the Library-folder and restored it via TimeMachine.

    • Carrie says:

      Hmm, I was convinced that this didn’t work on my end purely because this article was written in 2012 and Macs have evolved quite a bit since then. But then I saw your comment, which was posted in May 2020, which was only about 7 months ago.

      I’m no software engineer or OX sleuth by any means, but I’m wondering if the Big Sur update could explain why my terminal had absolutely 0 output when I entered the “modern” command posted by the author. (I also tried the “non-modern” version for the hell of it.)

  4. Nate says:

    Modern MacOS (10.13.6):

    defaults read /Library/Preferences/SystemConfiguration/ KnownNetworks | egrep -o ‘(SSIDString|_timeStamp).+’ | sed ‘s/^.*= \(.*\);$/\1/’ | sed ‘s/^”\(.*\)”$/\1/’ | sed ‘s/\([0-9]\{4\}-..-..\).*/\1/’

    (yes, i haven’t done the upgrade to Mojave just yet…)

  5. Adam says:

    To run this command in under Yosemite, the command needs to be altered, replacing “RememberedNetworks ” with “UpdateHistory” as follows:

    defaults read /Library/Preferences/SystemConfiguration/ UpdateHistory | egrep -o ‘(SSIDString|_timeStamp).+’ | sed ‘s/^.*= \(.*\);$/\1/’ | sed ‘s/^”\(.*\)”$/\1/’ | sed ‘s/\([0-9]\{4\}-..-..\).*/\1/’

  6. Adam says:

    Is there a way to do this in Yosemite? I’ve tried the code listed above, but it returns this error: The domain/default pair of (/Library/Preferences/SystemConfiguration/, RememberedNetworks) does not exist.

    • Paul says:

      Yes this works in OS X Yosemite, in fact in El Capitan and Yosemite you can shorten the command considerably for the same effect:

      defaults read /Library/Preferences/SystemConfiguration/ |grep SSIDString

      That will show you the list of all wi-fi networks a Mac has connected to in OS X 10.10 and OS X 10.11 etc

  7. kb says:

    defaults read /Library/Preferences/SystemConfiguration/ 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

  8. 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/ RememberedNetworks | sed -En 's/^ +"(SSID_STR|_timeStamp)" = "(.+)";/\2/p'

Leave a Reply


Shop on and help support OSXDaily!

Subscribe to OSXDaily

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

Tips & Tricks


iPhone / iPad



Shop on Amazon to help support this site