Easy (best) instructions for enabling local AI development on mac.

Tunnel to imaginary utopic city

Setting up SSH tunnel from mac to PC

Colab has security measures to prevent you from putting in any IP address in the Local Connections Settings dialog. These instructions mention that you can use gcloud command to point to a different machine using local port forwarding. However, it doesn’t show you how to do this for a mac to window set up (and maybe you don’t have gcloud installed). So, if you have a Windows PC with a GPU that you would like to run Python notebooks using colab on your mac (macbook), simply follow these instructions below:

  • On Windows PC (Win 10 or 11)
  • On Mac
    • Create ssh key (if you don’t already have a SSH public key which you use)
      • ssh-keygen -t rsa -b 4096 -C “<emailaddress>”
      • Should generate a public / private key pair in ~/.ssh (id_rsa and id_rsa.pub), the latter file is the public key
  • On Windows PC install
    • Copy ~/.ssh/id_rsa.pub (from Mac) to %ProgramData%\ssh\adminstrators_approved_keys (on Windows)
    • Set up permissions for administrators_approved_keys file
      • icacls administrators_authorized_keys /inheritance:r
      • icacls administrators_authorized_keys /grant SYSTEM:`(F`)
      • icacls administrators_authorized_keys /grant BUILTIN\Administrators:`(F`)
    • Restart openssh server through services or command line (net stop sshd & net start sshd)
  • Startup Jupyter on Windows
    • Type jupyter lab in a command prompt
    • Copy localhost connection string with token (starts with https://localhost::8888/lab?token=<token>)
  • On Mac
    • Start SSH tunnel
      • ssh -L 8888:localhost:8888 <windowsAccount>@192.168.1.xxx
    • Start up colab instance in browser
      • Click on “connect to a local runtime”
      • Paste in localhost connection string from above
        • Pro tip: I use google docs to share context across machines.
  • Troubleshoot
    • ssh -v or ssh -v -v -v (connection issues)
    • nc -z localhost 8888 || echo “no tunnel open” (test for liveness)