Has anyone tried running the Swift REPL within a local or remote SSH session?
xcrun swift
runs great within a local Terminal session, but fails for me with
error: failed to launch REPL process: process exited with status -1) (lost connection)
in an SSH session (either remotely via iPad or when ssh'd into localhost directly on my desktop Mac).
The problem is that OSX is trying to prompt you graphically for your password, but it can't do that over SSH. To get around this, you need to enable developer mode on the machine. You probably did it (unknowingly) by debugging a project in Xcode, which prompts you to enable developer mode.
You can also run this from the command line (including over SSH):
sudo /usr/sbin/DevToolsSecurity --enable
Assuming swift
is in your shell path:
$ ssh -t localhost swift
Password:
Welcome to Swift! Type :help for assistance.
1> 1
$R1: Int = 1
2> var foo = 10
foo: Int = 10
3> foo + 1
$R2: Int = 11
and remotely:
$ ssh -t [email protected] swift
Password:
Welcome to Swift! Type :help for assistance.
1> 1
$R1: Int = 1
2> 10
$R2: Int = 10
3>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With