Run Julia in Sublime on macOS

2022-02-02
#Julia #Unix #macOS

1. Step

Open Tools -> Build System -> New Build System in Sublime and paste these commands:

{
    "shell_cmd": "/Applications/Julia-1.7.app/Contents/Resources/julia/bin/julia $file",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.jl",
    "shell": true
}

Note that /Applications/Julia-1.7.app/Contents/Resources/julia/bin/julia is the installation path of Julia on macOS.

Save the file Julia.sublime-build at the path Sublime Text3/Packages/User.

In Tools -> Build System, Julia will be shown.

2. Test with Hello Julia

Save the command as Hello.jl:

println("Hello Julia!")

Use Command + B to run the Hello.jl file.

3. Reference