Remotely control your desktop over SSH on macOS
Using SSH port forwarding and VNC you can connect to your remote desktop using the Screen Sharing application.
First connect to your machine over SSH and port forward
$ ssh email@example.com -L 5900:localhost:5900
Then in another terminal, on your local machine, open Screen Sharing by passing a
open a VNC URL.
$ open 'vnc://localhost'
Screen Sharing should open and ask you for credentials for the remote machine. And then you do cool things on your remote desktop!
Read more about VNC here in this wikipedia article.
Hat Tip to Dorian Karter!Tweet