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, SSH Key Generation on Mac OS

Was this helpful?

What’s your goal today?

1. Find the right Web hosting solution

If you’re looking for industry-leading speed, ease of use and reliability Try ScalaHosting with an unconditional money-back guarantee.

2. Make your website lighting fast

We guarantee to make your WordPress site load in less than 2 seconds on a managed VPS with ScalaHosting or give your money back. Fill out the form, and we’ll be in touch.

Please enter a valid name
Please enter a valid website
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

3. Streamline your clients’ hosting experience

If you’re a web studio or development agency hosting more than 30 websites, schedule a call with Vlad, our co-founder and CTO, and see how we can deliver unmatched value to both your business and your clients.


Need a custom cluster or professional advice?

Book a meeting and get a free 30-minute consultation with Vlad, co-founder & CTO of Scala Hosting, who will help you select, design and build the right solution - from a single data center cluster to a multi-region & multi-datacenter high availability cluster with hundreds of servers.

Book a free consultation

4. Learn how to grow your website in 2024

An all-star team of SEO and web influencers are sharing their secret knowledge for the first time in years. Learn about the future of SEO, Web Design best practices and the secrets to getting the foundation for your website to thrive. Watch the exclusive webinar.

An Exclusive Insiders Look Behind The SEO and Web Development Curtain


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.