I have a CSV/TXT file with a list of network names and passwords (together with network/password/encryption types) that looks like this:

  ***Networkname1***    ESS WPAPSK  TKIP    passPhrase  ***password1***
  ***Networkname2***    ESS WPAPSK  TKIP    passPhrase  ***password2***
  ***Networkname3***    ESS open    WEP     networkKey  ***password3***
  etc etc

I am trying to import the wi-fi network settings (for wireless hotspots) to the Mac's Keychain app as I have just moved from a Windows 7 machine to a Mac (Yosemite).

Any ideas? Perhaps I can edit the Keychain file that keeps the list of network names and passwords?

Perhaps there is a way to edit a Keychain file that contains all the wifi passwords.

  • The migrate ought to have brought them over.
    – Tetsujin
    Aug 2, 2015 at 18:14

1 Answer 1


You're going to need to write a script to read your csv and parse it properly to one of the following terminal commands:

Apple has a KB of the security command (keychain access manager).

You'll need something like:

security add-generic-password -a $User -D "network password" -S $SSID -w $Password

Like -

security add-generic-password -a Raystafarian -D "network password" -S Raystafarian -w MyPassword

There's also the networksetup command KB to join a network -

networksetup setairportnetwork $device_name $SSID $Password

You can find which device name to use with

networksetup -listallhardwareports

You can also set preferred networks with (This is what I would use)

networksetup -addpreferredwirelessnetworkatindex $device_name $SSID $Index $Security_type $Password

Like -

networksetup -addprefferedwirelessnetworkatindex en1 Raystafarian 1 WPA2 MyPassword

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.