sshclojureremote-accessleiningennrepl

Clojure - how to connect to running REPL process remotely


How can I connect to a REPL session running on a remote server that I can access, for example via SSH?


Solution

  • This might be obvious to network specialists but took me a while to find out so documenting it here.

    On the remote server, when launching your REPL application instead of just lein repl force binding to a port:

    lein repl :start :port 40000
    

    On your machine, connect to the remote server the normal way (for example via ssh). Then connect to your application this way:

    lein repl :connect localhost:40000
    

    That's it!