Home > How to Tips

How to Create an SSH Config File on Mac Easily?

Updated on Friday, March 21, 2025

iBoysoft author Yvonne Feng

Written by

Yvonne Feng
Professional tech editor

Approved by

Jessica Shee

English Français やまと Português

Summary: This article guides you on how to create an SSH config file on a Mac, including using TextEdit, Terminal, Automator, etc. Download iBoysoft MagicMenu to quickly create an SSH config file on Mac.

summary-create-ssh-config-file-mac

If you frequently connect to remote servers via SSH on your Mac, creating an SSH config file can save you time and effort.

This guide explains multiple ways to create an SSH config file on Mac, including TextEdit, iBoysoft MagicMenu, Terminal, and Automator. Follow us to know how to do it.

Create an SSH Config File on Mac by TextEdit

If you have never used SSH or your computer does not have the ~/.ssh/ directory, you need to create it first.

You can open Terminal and enter the following command to create the .ssh directory:

mkdir -p ~/.ssh

 Then, run the following command to ensure the correct permissions for the .ssh directory:

chmod 700 ~/.ssh

TextEdit is the default text editor on macOS, providing a simple and efficient way to create and modify configuration files. With its intuitive interface, you can edit files without needing to remember complex terminal commands.

It's important to note that the SSH config file must be in plain text format. If saved as a rich text file (.rtf), SSH will not recognize it.

Here is how to create an SSH config file using TextEdit:

  1. Press Command + Space to open Spotlight, type “TextEdit,” and press Enter to launch TextEdit.
  2. Click the Format menu and select Make Plain Text (or press Shift + Command + T).
  3. Enter your SSH configuration, for example:Host myserver
       HostName 192.168.1.1
       User myusername
       IdentityFile ~/.ssh/id_rsa 
  4. Click File > Save. 
  5. In the Save As window, name the file config (without any extensions) and choose the ~/.ssh/ directory as the save location. 
     save-as-window-name-config
  6. Click Save and close TextEdit.

Create an SSH Config File on Mac through iBoysoft MagicMenu

Using iBoysoft MagicMenu is the fastest and most convenient way to create an SSH config file. As a professional right-click extension for Mac, it makes your workflow smoother and more efficient.

With iBoysoft MagicMenu, you can effortlessly create SSH config files and various other file types, including TXT, DOC, DOCX, XLS, PDF, PPT, Keynote, Pages, and XML. Simply right-click on a space in Finder or your desktop, and you can instantly generate the file you need.

Here is how to create an SSH config file on Mac with iBoysoft MagicMenu.

  1. Download, install, and open iBoysoft MagicMenu. 
  2. Click New File in the main interface > the add button (+).
  3. In the pop-up window, select the config file as the template and name it SSH Config for quick find later. (Make sure you've created a config file as the template in TextEdit beforehand and saved it to your desktop for easy access.) 
  4. Open Finder, press Command + Shift + G, type ~/.ssh/, and press Enter to go to the .ssh/ directory.
  5. Right-click on an empty space, select "New File", then click "SSH Config". This will create a config file in the .ssh/ directory. 
  6. (Optional) Double-click the config file, enter the SSH configuration, then click "File" > "Save" to ensure it is in plain text format.Host myserver
       HostName 192.168.1.1
       User myusername
       IdentityFile ~/.ssh/id_rsa  

 Note: If you already entered the SSH configuration when creating the config file template, you can skip Step 6, as no manual editing is needed.

As you can see, it is incredibly simple to create an SSH config file using iBoysoft MagicMenu. While setting up the template may take effort, once it's done, you can instantly create an SSH Config file with a right-click, making the process highly efficient and convenient!

If you like this right-click extension software, share it with your friends.

 

Create an SSH Config File on Mac via Terminal

Terminal is a commonly used tool for Mac users, and you can use Terminal to create an SSH config file on your Mac. This process involves multiple commands, so if you are not very familiar with Terminal, please read the following guide carefully.

  1. Open Terminal. 
  2. Make sure you have created a .ssh directory. If not, go to the first method to create it. 
  3. Use the following command to create and open the config file in the Nano editor. If the file doesn't exist, Nano will create it. If it does exist, Nano will open it for editing.nano ~/.ssh/config 
  4. Inside Nano, enter your SSH configuration details. For example:Host myserver
       HostName 192.168.1.1
       User myusername
    IdentityFile ~/.ssh/id_rsa  
  5. Press Control + X, then Y, and hit Enter to save. 
  6. Run the following command to ensure that the config file has the correct permissions. chmod 600 ~/.ssh/config 
  7. Running the following command to test the SSH configuration. ssh myserver 

If everything is set up correctly, this should connect you to the server without requiring you to manually enter the hostname or specify the key file.

Share this post to tell more people how to create an SSH config file on Mac via Terminal.

 

Create an SSH Config File on Mac using Automator 

Automator is a built-in tool in macOS that helps you create an SSH Config file without manually using Terminal or Finder. The process is somewhat complex, so please follow the steps carefully to make sure everything runs smoothly.

  1. Open Automator. In the Automator interface, click New Document, select Workflow, and then click Choose. 
  2. In the Library panel on the left, click Files & Folders. Find a New Text File, then double-click it (or drag it into the workflow area).
  3. Set Where to ~/.ssh/ (If .ssh does not exist, create it first using Terminal: mkdir -p ~/.ssh/). Set File Name to config. Choose Plain Text as the file format. 
     
  4. Click the Options button in the "New Text File" action and check Show this action when the workflow runs (if you want to customize each config file). 
  5. To automatically fill the config file with default SSH settings, you can enter your SSH configuration, such as: Host myserver
       HostName 192.168.1.1
       User myusername
       IdentityFile ~/.ssh/id_rsa 
  6. In the Actions Library, search for Run Shell Script and drag it below the "New Text File" action. In the script field, enter the following command. This ensures the SSH Config file has the correct permissions.chmod 600 ~/.ssh/config
  7. Click File > Save, name the workflow "Create SSH Config File", and save it as an Application. Now, whenever you need to create an SSH Config file, simply double-click the saved application, and it will generate the file in ~/.ssh/.

Conclusion

Overall, we have introduced four methods to create an SSH config file on Mac. You can choose any of the above methods, each with detailed step-by-step instructions.

By the way, if you want to quickly create an SSH config file or other files on Mac, don't forget to use iBoysoft MagicMenu, a right-click enhancement tool.

Share this article with more people to help them create an SSH config file on a Mac!