How to Generate an SSH Key Pair in Mac OS

Using Secure Shell Protocol (SSH) is a safer way of connecting to your web hosting server. SSH uses key pairs to ensure that the right client-server duo is communicating. This method offers greater integrity over a username and password authentication.

For SSH, the key pair involved is a private and public key. You must generate them at the same time on the same device. The method for SSH key pair generation will vary depending on what device you are using.

SSH Key Generation on Mac OS

  • Step 1. Open the Terminal via Applications -> Utilities -> Terminal
  • Step 2. Enter the following command: “ssh-keygen -t rsa”
  • Step 3. Provide the location where you wish to save the generated keys. Remember to include the file name to which you want to save them. For example, “/home/username/.ssh/mykeys_rsa”

If you do not wish to provide a custom location, hit enter to accept the default save location. By default, generated keys are save in “/home/yourusername/.ssh/” with the public and private keys named “id_rsa” and “” respectively.

  • Step 4. After key generation, the system will ask for a passphrase. You may skip this step by hitting the enter key. Hit the enter key again when asked to reconfirm the passphrase.

When complete, you should see a message similar to the following:

How to Generate an SSH Key Pair in Mac OS


Working in the web hosting industry for over 13 years, Rado has inevitably got some insight into the industry. A digital marketer by education, Rado is always putting himself in the client's shoes, trying to see what's best for THEM first. A man of the fine detail, you can often find him spending 10+ minutes wondering over a missing comma or slightly skewed design.

Write a Comment