Depending on the device you are using, you download the appropriate one version of Julia from page installations on the official site.
Double-click the image of the downloaded disk (in the downloads folder) to load it.
Drag the Julia-1.X.Y
app to the shortcut folder
Applications.
After installation, opening Julia shows the Julia's interactive mode, called REPL (Read Evaluate Print Loop), at which you can write your first code on the command line like shown below:
println("Hello World!$! \n The sum of 3 and 5 is: ", 3+5)
Running Julia in terminal requires adding Julia Language to the PATH Environment Variables.
Press cmd + space
and search for terminal.
Copy and paste the following two commands:
$ rm -f /usr/local/bin/julia $ ln -s /Applications/Julia-1.8.app/Contents/Resources/julia/bin/julia /usr/local/bin/julia
If your mac has an M-series processor, you may want to consider downloading both the Intel/Rosetta and the M-series releases of Julia. If you run into a package that doesn't work on your M-series processor, you can then switch to the Intel/Rosetta version.
For M-series macs: Add juliarosetta
to your PATH
. First, rename the Julia-1.8
(Intel version) Application to Julia-1.8-Rosetta
.
rm -f /usr/local/bin/juliarosetta ln -s /Applications/Julia-1.8-Rosetta.app/Contents/Resources/julia/bin/julia /usr/local/bin/julia
At this point you can open the command prompt (Windows users) or the terminal (MacOS and Linux users) and typing "julia" will display the Julia REPL.
Packages contain modules, tests and documentation. They expand the basic functionality of Julia.
Julia has a built-in package manager for installing add-on functionality written in Julia.
Open the Julia REPL.
In the command prompt type using Pkg
and press ENTER
.
To load a package, write the command.
Pkg.add("YourDesiredPackage")
To load multiple packages you can also use the command:
for pkg in ["DifferentialEquations", "Turing", "DataFrames", "Plots"] Pkg.add(pkg) end
Open the Julia REPL.
In the command line type ]
To load a package, write the command
add YourDesiredPackage
For more information about the packages available for Julia check the links found on their page packages on the official site.
For larger programs, it 's recommended to download a code-editor or an IDE (Integrated Development Environment).
A code-editor accelerates and makes programming easier by
providing syntax highlighting by displaying keywords language and syntax errors with visually distinct colors
detecting errors & much more!
IDEs present a single program with capabilities to create, modify, compiling, developing and debugging the software.
We reccomend:
VS Code
Jupyter
A single editor or IDE is very likely to cover all of your needs needs, so you can choose one of the above and find below information about its installation.
Depending on the device you are using, download the appropriate one version of VS Code from page installations in official site.
Download Julia extension
directly from VS Code Marketplace or download it manually from within VS Code by going to in extensions (extensions) and downloading the extension with the name Julia.
Now you can make a new file, save it ending with .jl
and run it.
At this point you should be able to run VS Code. If the extension does not automatically detect the Julia installation, follow the steps below. You need to manually set julia.executablePath to point to the executable Julia file that the extension should use.
To find the path you will need you will need to download the file labeled 64-bit.tar.gz
from page installations by Julia.
Copy the file path shown below:
Open VS Code and select the following from the menu bar in the top of your screen : File->Preferences->Settings
(or press cmd + ,
) and look for julia.executablePath
in search bar.
Paste the file path you copied in step 3, close settings and restart VS code.
Download Anaconda from its official site Anaconda.
Browse your apps and open Anaconda Navigator.
There you will find Jupyter Lab and Jupyter Notebook installed.
To start writing a Jupyter notebook, just type the following command: jupyter notebook
.
Open the Julia REPL.
Install the package : IJulia
.
Type in the code line : using IJulia
and press ENTER
.
Write notebook()
in the code line and press ENTER
.
When install Jupyter via Conda, y/n [y]:
appears, press ENTER
and you will
start installing Jupyter.
After the installation is complete, write exit()
and restart the Julia REPL
.
Repeating the steps 3 & 4 you will open Jupyter in your browser.
Those who already have Python 2.7.9 (or later) or Python 3.4 (or later) installed, can ignore the Python installation move to installation of Pip.
Download the Python installer from its official site Python.
To confirm that python is installed on your system, open terminal and type python
.
🤞The version of python you have installed will be displayed if the python successfully installed on your device.
Pip is a powerful package management system for Python packages.
All versions of Python 2 (later than 2.7.9) and Python 3 (later than 3.4) that are installed from the official python site, also install pip.
To confirm you have pip installed on your system:
Open terminal & type pip -V
If a message appears with the version of pip, then you are ready to proceed.
Open terminal and type :
$ python -m pip install –upgrade pip
Open the terminal and create a virtual environment with the command pip3 install virtualenv
.
Create a virtual jupyter environment and activate it with the command: virtualenv jupyter source jupyter/bin/activate
.
Open the terminal and type the command: pip3 install jupyter
.
To start writing a Jupyter notebook, just terminal : jupyter notebook
.
If you didn't follow the 2nd way to install Jupyter, you will need to to add a package that will allow you to use the Julia language in Jupyter.
Open the Julia REPL in any of the ways mentioned.
Write in the REPL the command : using Pkg
.
Add the IJulia
package by typing the command: Pkg.add("IJulia")
.
At this point you are ready to write scripts. But in order to equip yourself with the knowledge to write the brief and beautiful code provided by Julia, it would be good to get started with Julia.
© 2024 Ioannis Tsagkaropoulos. All rights reserved.