Programmatically Obtain Recent Wi-Fi Networks On A Mac

When you join a wireless network on a Mac, the information for that network is cached into the com.apple.airport.preferences property list. You can access this information using the following command, constraining output to the LastConnected field and the next 7 lines: defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences | grep LastConnected -A 7