Open Julia in iTerm2 by default, instead of Terminal

question

#1

I installed Julia on macOS High Sierra (10.13.3) with brew cask install julia, and it opens in Apple Terminal by default.
I am completely new to AppleScript, so I don’t know how to change the default behavior of Julia so that it opens in iTerm2 by default. (App ID - com.googlecode.iterm2).

This is the script for starting Julia:

set RootPath to POSIX path of (path to me)
tell application id "com.apple.terminal"
	do script ("exec '" & RootPath & "Contents/Resources/julia/bin/julia'")
	activate
end tell

Any idea how this can be done?


#2

I guess, and this is a GUESS,:

set RootPath to POSIX path of (path to me)
tell application id "com.googlecode.iterm2"
	do script ("exec '" & RootPath & "Contents/Resources/julia/bin/julia'")
	activate
end tell

#3

How are you opening it? Why not just type “julia” from within iterm2? You may need to set up an alias for this to work.


#4

It doesn’t work, I tried it yesterday too. It says, “expected end of line, but found script”. Don’t know what it means, though.


#5

Yes, I can open it with Julia within iTerm2, but I prefer opening Julia through Spotlight (i.e. through the executable by searching it, and then running it), but the script that is run by Julia invokes Terminal by default, and not iTerm2 (and I can’t change the script so that it invokes iTerm2, don’t know why. Throws up an error). Just a matter of convenience.