Storing passphrase in keychain

May 04, 2022
$ ssh-add --apple-use-keychain ~/.ssh/
Enter passphrase for /Users/llimllib/.ssh/
Identity added: /Users/llimllib/.ssh/ (key for

that's it! now you can just use that key and ssh will grab the passphrase from keychain.

From here, with a useful caveat:

(If this fails, make sure you are using Apple's version of /usr/bin/ssh-add and not something installed with brew etc.; check with which ssh-add)

I missed step two, which is to add it to the ssh config file ~/.ssh/config:

 Host *
   UseKeychain yes
   AddKeysToAgent yes
   IdentityFile <keyfile>
   ...any amount of IdentityFiles you want ot use keychain for...
↑ up