I have a passphrase on my ssh id_rsa key, and OS X asks me for the passphrase the first time I want to use it, but even if I decline to add it to my keychain, it doesn't ask me for a passphrase again until I reboot. How can I make it ask me for a passphrase every time I try to use it?

  • Have you tried fully closing out your Terminal session?
    – Allan
    Jun 8, 2016 at 20:39
  • yup that doesn't work. only thing that works is logging out as the user altogether. Maybe theres a command i can type into the terminal to tell it to forget the passphrase? Jun 9, 2016 at 0:05
  • how do you " decline to add it to my keychain,"? What does ssh-add -l prints after the first use? And what about echo $SSH_AUTH_SOCK?
    – Jakuje
    Jun 9, 2016 at 7:21

2 Answers 2


While reading GitHub documentation about adding ssh key to the ssh agent, I thought you might be able to prevent loading keys in the agent by modifying the ~/.ssh/config file like so:

Host *
 AddKeysToAgent no
 UseKeychain no
 IdentityFile ~/.ssh/id_rsa

Execute following command in Termina.app will disable Keychain integration, thus ssh will always ask you for a passphrase:

defaults write org.openbsd.openssh KeychainIntegration -bool false

Pleases note:

  1. This is undocumented, but as far as I know, it works from macOS 10.6 (Snow Leopard) to 10.11 (El Capitan)
  2. It will affect all private keys, not just id_rsa
  3. Set the value to true if you want to recover the default behavior
  4. Kill ssh-agent process or restart your Mac if it has no effect after executing the command
  • its still remembering the passphrase unfortunately, even after doing this. I'm on Sierra now but it was still happening even with El Capitan... Sep 29, 2016 at 14:34
  • @MohamedHafez Maybe go into the Keychain app and delete the entry? (just search for ssh)
    – Fab
    Sep 28, 2018 at 16:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .