MacOS has a built in SSH server. I generally leave it off, and only turn it on when necessary. To do that from the command line:
sudo systemsetup -setremotelogin on
To see if it is on:
sudo systemsetup -getremotelogin
Source. You can also turn it on from Preferences -> Sharing