Enabling SSH on macOS via Terminal
Turn on SSH
Enable the SSH service:
sudo /usr/sbin/systemsetup -setremotelogin on
Permit