Extract Saved Wi-Fi password on macOS

Today I learned that I can get saved wifi passwords from macOS Keychain via command line.

security find-generic-password -ga YOUR_WIFI_SSID | grep "password:"

That will ask me to fill in the administrator password, use your macOS login should work.

Resource

https://www.howtogeek.com/656994/how-to-see-all-your-saved-wi-fi-passwords-on-macos/