I have two MacBook Pros, one with an Intel and one with an M1 processor. From time to time I need to run code on the Intel Mac, e.g. Docker images that are only available for Intel chipsets.

Instead of switching between the two Macs, I’d rather open a terminal window on one and use the other remotely.

Let’s say my main workstation is A and I want to SSH into B.

Here are the steps to set up the two machines for remote SSH operation.

On B, enable the “Remote Login” option. This can be found under System Preferences → Sharing.

On Mac A, generate an SSH key.

In ~/.ssh trigger key generation with:

ssh-keygen -f macb

I usually give keys descriptive names so I know which is which. For simple development purposes I keep the options default and leave the passphrase empty.

Now copy the public key to machine B. Replace <youruser> and <host> accordingly:

ssh-copy-id -i macb.pub <youruser>@<host>

You should now be able to SSH into machine B, but I usually add the following entry to the config file in the ==~/==.ssh directory. If the file doesn’t exist, create it.

Host macb
	HostName <hostname or IP>
	User <youruser>
	IdentityFile ~/.ssh/macb

Everything is set up now and you can connect from machine A to machine B with:

ssh macb

That’s it! I hope this was useful.

Thank you for reading!