How to make julia.app launch in iTerm instead of macOS' Terminal.app?

Viewed 374

I installed the Julia language for macOS as downloaded from the official website. When I launch Julia, the REPL is launched in macOS's Terminal.app, but I wish to have it launched from iTerm. How can I tell julia to launch iTerm instead of Terminal.app?

3 Answers

The julia app uses apple script to tell the terminal to launch its process. You can modify the script and tell iTerm to be opened instead. For this:

  1. Go to Go to Applications> press option-click (or right click if you have it) on the julia app you wish to modify and then click show package contents > contents > Resources > Scripts, and modify main.scpt.

My script reads

tell application "iTerm"
    tell current window
        create tab with default profile command "/Applications/Julia-1.5.app/Contents/Resources/julia/bin/julia"
        activate
    end tell
end tell

This makes the julia app to launch iTerm with the default profile instead of Terminal.app. It is possible that you need yo modify this path if the app is not called Julia-1.5, as in my case.

A second option is to create a symbolic link in your path to the Julia executable. For the example above, enter the following command in the terminal application of your choice:

ln -s /Applications/Julia-1.5.app/Contents/Resources/julia/bin/julia /usr/local/bin/julia

You will have to update this link to the path for the correct version whenever you upgrade Julia.

Now all you have to do to run the Julia REPL in iTerm (or any terminal application) is enter the command julia. (This assumes that /usr/local/bin is in your path.)

Add an alias in ~/.bash_profile or ~/.zshrc:

alias julia='/Applications/Julia-1.7.app/Contents/Resources/julia/bin/julia'

Change the version accordingly.

Note: Although this seems not the exact answer of the question, it leads to the same result of "making Julia launch in iTerm".

Related