To enable remote SSH login, follow the steps below
1. Go to System Preference
You can go to the system preference by clicking the apple icon located at top left screen of your Mac and select System Preference. Second way to do this is to using the “Command + Space” key to access the Spotlight Search and enter “System Preference” and press Enter/Return key. You should see the following screen for System Preference.
2. Go the Sharing
In the System Preference, select Sharing, you will see the settings similar to this screen.
3. Enable Remote Login
After you click on Sharing, you will see the list of Service available, check/tick the Remote Login box and you will see the Remote Login is set to On, you should test your ssh connection and see if it works.