Get a List of Preferred Wi-Fi Networks from the Command Line

Jan 3, 2013 - Leave a Comment

Retrieving a list of preferred wireless networks can be helpful when troubleshooting wi-fi problems. The following trick will do just that, and it’s similar to a tip we covered recently which showed how to see a list of previously connected wi-fi networks using either System Preferences or a lengthy command line string, but as far as the command line goes the following command is much shorter and cleaner, and doesn’t require the use of sed and regex to clean up the output. Though similar, it’s important to note there may be some differences in the output of the commands too, as this trick provides a list specifically of the preferred networks, whereas the aforementioned article discussed retrieving networks that the Mac has simply connected to, whether they are preferred or not. Which information is going to be the most useful to you will likely vary on your use case.

For a MacBook Air with only a Wi-Fi NIC, the command would be as follows:

networksetup -listpreferredwirelessnetworks en0

Meanwhile, iMacs, Mac Mini’s, Mac Pro’s, and some MacBook Pro’s with dual Wi-Fi and Ethernet capabilities might use the following instead:

networksetup -listpreferredwirelessnetworks en1

The command is the same, the only difference is the interface used at the end of the command (en0 vs en1), which is sometimes different on different Macs, particularly those with wifi and ethernet capabilities.

For those who are less comfortable with the Terminal and want a simpler GUI approach, the aforementioned article’s Network Preferences method remains less technical.

This nice little tip comes as a commenter response on MacWorld to coverage of our original method.

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

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