I was looking for a nice and neat way to integrate ssh-agent into the Mac environment but could not get my shell scripting approach to gel elegantly. While doing the obligatory search on the web I found and fell in love with SSHKeychain.
This little app does all the had work (running ssh-agent from the correct place and exporting your keys into memory with ssh-add) for you, and more ... It not only handles the ssh-agent side of things but also provide support for integrating with the Apple Keychain and forward local ports over a ssh connection to set up ssh tunnels.
Go see the full feature list for more info.
Here are the step from their site:
- Download SSHKeychain.dmg and mount it.
- Copy SSHKeychain (SSHKeychain.app) to your Applications folder.
- Run SSHKeychain. This should open a dock item and a statusbar item.
- Click either the Statusbar Item, the Dock Item, or Main Menu and open the Preferences.
- Open the Environment tab.
- Enable "Manage global environment variables". This will make SSHKeychain available for other applications.
- Open the keys tab and see if any of your keys are missing (~/.ssh/id_dsa and ~/.ssh/identity are default).
- Re-login to make the global variables work.
- Start up SSHKeychain, and you're set.
If you followed the installation instructions above there should be nothing further to do (assuming you had some pre-created keys in the default place like I had).
When I now fire Terminal.app up and log into a box that has my public key on it no password is required and I am logged in without further ado.