Enable SSH on Mac
OS X has a built-in SSH server, you only need to enable it in System Preferences.
  1. Choose Apple menu > System Preferences, and then click Sharing.
  2. Check the Remote Login service.
  3. Next to “Allow access for”, choose all users.
    Or select “Only these users”, and customize the list.
Related information
Establish a secured connection
Connect to a Mac using authentication key for SSH