Skip to content

Instantly share code, notes, and snippets.

@partikus
partikus / README.md
Created November 13, 2023 06:45 — forked from lmb/README.md
macOS: use ssh-agent from homebrew

This recipe allows you to use the ssh-agent from homebrew with the auto generated SSH_AUTH_SOCK in /private/tmp. It works because disabling com.openssh.ssh-agent doesn't stop launchd from allocating SSH_AUTH_SOCK. com.homebrew.ssh-agent spawns a shell to remove the socket and then execute the homebrew ssh-agent.

  1. Install openssh from homebrew
  2. Disable the built in macOS agent: launchctl disable gui/$UID/com.openssh.ssh-agent
  3. Copy com.homebrew.ssh-agent.plist into ~/Library/LaunchAgents
  4. Enable the new agent: launchctl bootstrap gui/$UID com.homebrew.ssh-agent.plist
  5. Ensure that the correct agent is running: