Issue with ssh-agent not loading passphrases during boot in MacOS Sierra 10.12

After a recent update of MacOS Sierra (10.12), I noticed that my ssh private key passphrases were no longer loading from Keychain on the initial boot or restart of my MacBook Pro. The first time this happened, I thought I just needed to enter it once and that it would be okay after that. That theory proved to be incorrect.

I did a bit of research and found the last comment in this post, indicating this new behavior is expected. Based on the comment and info from Apple Engineering, it sounds like Mac OS X should have never automatically loaded the passphrase on reboot. The more I think about this, it makes sense to have MacOS behave like other Unix systems running OpenSSH.

Some additional digging provided a great solution via JJJ on Github (See original Github post and comment below). Just add the following to your shell profile. In my setup, I have added the recommended solution to my ~/.zshrc file. See the commit here: Added fix for loading ssh private key passphrases into ssh-agent · shrop/dotfiles@8ee6b81 · GitHub.

I hope this helps others who run into the same issue.

27348363: Mac OS X 10.12: ssh-agent does not automatically load passphrases on the keychain during startup · Issue #15361 · lionheart/openradar-mirror · GitHub

Blog Category: