Stop Typing Your SSH Passphrase
Every time you reboot, your Mac forgets your SSH key passphrase. Annoying. Here's the fix — takes two minutes.
Tell SSH to use the Keychain
Open ~/.ssh/config and drop this at the very top:
Host *
AddKeysToAgent yes
UseKeychain yesHas to be at the top. SSH reads the file top to bottom and uses the first rule that matches, so if you put it at the bottom it won't do anything.
Add your keys once
Now run this for each key you have:
bash
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
ssh-add --apple-use-keychain ~/.ssh/id_rsaEnter the passphrase one last time. macOS stores it in Keychain and from now on loads it automatically on login.
Reboot. Done. Never think about it again.
If you sync your dotfiles to a Linux machine, add IgnoreUnknown UseKeychain above the Host * block or you'll get a warning. Linux doesn't know what Keychain is. Can't blame it.
Comments