Search the articles in our knowledge base!

How to generate an SSH key pair in Mac OS?

You can generate a key in Mac OS using the ssh-keygen command. You should run it in Terminal. You will be asked for a file in which the key should be saved to and for a passphrase (password) for the key:

user@localhost: ssh-keygen -t dsa


Generating public/private dsa key pair.

Enter file in which to save the key (/Users/user/.ssh/id_dsa): id_dsa

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in id_dsa.

Your public key has been saved in

The key fingerprint is:

16:8e:e8:f2:1d:c9:b9:cf:43:9a:b3:3c:c1:1f:95:93 user@localhost

This will create a private key written to ~/.ssh/id_dsa and a public key written to ~/.ssh/ The passphrase is used to protect your key. You will be asked for it when you load your key. You can do that using the following command:

ssh-add ~/.ssh/id_dsa

VN:F [1.9.22_1171]
Rating: 2.8/5 (20 votes cast)
How to generate an SSH key pair in Mac OS?, Rating 2.8 out of 5 based on 20 votes