For Linux/Mac users, the easiest way to install Julia language is to open a terminal and type the following command to install Julia with juliaup
curl -fsSL https://install.julialang.org | sh
If you are suffering from the slow download speed. An alternative approach is downloading the corresponding Julia binary from the tuna mirror website. After installing the binary, please set the Julia binary path properly if you want to start the Julia REPL by typing julia
a bash shell. To add Julia's bin folder (with full path) to PATH
environment variable, you can edit the ~/.bashrc
(or ~/.bash_profile
) file. Open the file in your favourite editor and add a new line as follows:
export PATH="$PATH:/path/to/<Julia directory>/bin"
Please check this official setup guide to learn more.
Revise
in the startup fileFirst create a new file .julia/config/startup.jl
with the following content
ENV["JULIA_PKG_SERVER"] = "http://cn-southeast.pkg.juliacn.com"
try
using Revise
catch e
@warn "fail to load Revise."
end
The contents in the startup file is executed immediately after you open a new Julia session.
Then you need to install Revise, which is an Julia package that can greatly improve the using experience of Julia. To install Revise
, open Julia REPL and type
julia> using Pkg; Pkg.add("Revise")
To exit Julia REPL, just press CTRL
-D
.
As a final step, please check your Julia configuration by openning a Julia REPL and type
julia> versioninfo()
Julia Version 1.8.2
Commit 36034abf260 (2022-09-29 15:21 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 8 × Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
Threads: 1 on 8 virtual cores
Environment:
LD_LIBRARY_PATH = /usr/lib/x86_64-linux-gnu/gtk-3.0/modules:
JULIA_PKG_SERVER = http://cn-southeast.pkg.juliacn.com
Please make sure your JULIA_PKG_SERVER
is set properly.
Install VSCode by downloading the correct binary for your platform from here. Open VSCode and open the Extensions
tab on the left side-bar of the window, search Julia
and install the Julia extension.
You are ready to go, cheers!
A Julia REPL has four modes,
Julian mode is the default mode that can interpret your Julia code.
Shell mode is the mode that you can run shell commands. Press ;
in the Julian mode and type
shell> date
Sun Nov 6 10:50:21 PM CST 2022
To return to the Julian mode, type the Backspace
key.
Package mode is the mode that you can manage packages. Press ]
in the Julian mode and type
(@v1.8) pkg> st
Status `~/.julia/environments/v1.8/Project.toml`
[295af30f] Revise v3.4.0
To return to the Julian mode, type the Backspace
key.
Help mode is the mode that you can access the docstrings of functions. Press ?
in the Julian mode and type
help> sum
... docstring for sum ...
To return to the Julian mode, type the Backspace
key.
Learn more from the official documentation about Julia REPL.
To open a pluto notebook, you should have Pluto
package installed in your global environment by typing in the Pkg mode
pkg> add Pluto
Copy-pasting the following command to the end of your ~/.bashrc
file enables you to open a pluto notebook from a Linux shell.
alias pluto='julia -e "using Pluto
if length(ARGS) > 0
notebook = ARGS[1]
Pluto.run(notebook=joinpath(pwd(), notebook))
else
Pluto.run()
end"'
To open a Pluto notebook in your browser, please open a new shell and type pluto path/to/pluto/file
. If the path is not provided, the command will open a the Pluto start up page in your browser.