# Getting started

To install Julia on your computer, visit http://julialang.org/downloads/ and follow instructions. You can then run the Julia interpreter using a terminal app on your computer. This is known as using the REPL.
Alternatively, you can use Julia online, in your browser, at sites such as NextJournal and Repl.it.
If you’d prefer to work locally, you can also use free but more powerful (and complicated) software packages such as Juno (based on Atom) and VisualStudio Code. Another popular way to run Julia is from a Jupyter notebook, via the IJulia.jl package. Jupyter is the interactive notebook technology that lets you run code in Julia, Python, and R in a browser window. Setting these up for working with Julia is usually straightforward, but you’ll probably have to follow a list of instructions carefully. The simplest way to start is to fire up the REPL.

## On macOS

On a Mac, you download the Julia DMG, double-click to open it, and drag the icon to the Applications folder. To run Julia, you can double-click the icon of the Julia package in the /Applications folder. This opens the terminal application, and starts a new window. This is the REPL, introduced in the next section:
Alternatively, you can type, in a terminal, something like this:
Here you’re specifying the path name of the Julia binary executable that lives inside the Julia application bundle. The exact version name might be different — check it using this command, which shows all available versions:

### Running directly from terminal

Typically, Julia is installed in /Applications, which isn't included in your PATH, and so the shell can't find it when you type julia on the command line.
But there are clever things you can do with paths and profiles, so that you can log in to a terminal and type julia with immediate success.
For example, after you find out the location of the Julia binary executable file (see above), you can define the following alias:
Obviously this will have to be updated every time the version number changes.
As an alternative, you could add the /Applications/Julia... path to the PATH variable (the mechanism that the OS uses to find executable programs on your system):
A different approach is to create a link to the executable and put it into the /usr/local/bin directory (which should already be in your path), so that typing julia is the exact equivalent of typing /Applications/Julia/.../julia. This command does that:
Whichever method you choose, you can add the relevant command to your ~/.bash_profile or ~/.zprofile files, which run every time you start a new shell.
You can add the 'shebang' line at the top of a text file ('script') containing Julia code, so that the shell can find Julia and execute the file:
This also works in a lot of text editors, where you can choose Run to run the file. This works if the editor reads the user's environment variables before running the file. (But not all do!)

### Running a Julia program

If you have a text file containing Julia code, you can run it from the command line:
or from within the Julia REPL:
If the first line specifies a Julia interpreter:
or
you can run the file like this:

### Running a script with Julia

If you want to write Julia code in an editor and run it, in true scripting-language fashion, you can. At the top of the script file, add a line like the following:
where the pathname points to the right place on your system, somewhere inside the relevant Julia application bundle, or:
This is called the shebang line.
Now you can run the script from inside the editor in the same way that you'd run any other script, such as a shell or Perl script.

### Using Homebrew

If you're a fan of homebrew, you should be able to install Julia with:

## On Windows

On a Windows machine, you download the Julia Self-Extracting Archive (.exe) 32-bit or 64-bit. Double-click to start the installation process.
By default, it will install to your AppData folder. You may keep the default or choose your own directory (eg. C:\Julia).
After the installation has finished, you should create a System Environment variable called JULIA_HOME and set its value to the \bin directory under the folder where you installed Julia.
It is important to point JULIA_HOME to the /bin directory instead of the JULIA directory.
Then you can append ;%JULIA_HOME% to your PATH System Environment variable, so you can run scripts from any directory. Make sure that the registry key HKEY_CURRENT_USER\Environment\Path is of type REG_EXPAND_SZ, so %JULIA_HOME% gets expanded properly.

## On FreeBSD

To install Julia on FreeBSD (including TrueOS) or DragonFly BSD you can use either a binary package or using the ports system.

### Installing from package

Installing the Julia package is straightforward. Open up a terminal and type:
To remove the package again you can use:

### Installing from ports

If you have the ports collection installed on your system (you can do so using running the command portsnap auto) the following is the canonical way to compile and install Julia onto your system:

## On Linux
### Using Binaries

You can use Julia direct from the binaries, without installing it on your machine. This is useful if you have old Linux distributions or if you don't have administrator's access to the machine. Just download the binaries from the website, and extract to a directory. Go into this directory (using cd), then into the bin folder. Now type:
If the program doesn't have permission to run, use the following command to give this permission:
In principle, this method could be used on any Linux distribution.

#### A better setup

If you want to run it by just typing julia in the terminal, you can set it up as follows. We'll assume you've downloaded the binary and extracted it to the folder /home/user/julia13.
Do one or more of the following:
1: add the following line to your ~/.bashrc file:
(You'll have to re-run this file, either by restarting the terminal or using ~/.bashrc.
2: Add /home/user/julia13/bin/julia to your PATH environment variable.
3: Create a symlink to the julia executable to somewhere that is in PATH. For example:

### Installing from package

This is the easiest way to install Julia if you're using Linux distributions based on RedHat, Fedora, Debian or Ubuntu. To install, download the respective package from the website (or JuliaPro), and install using your favorite way (double-clicking on the package file usually works). After doing this, Julia will be availabe from command line. On a terminal you can do:

#### Ubuntu Linux

On Ubuntu Linux, Julia is available as a snap package, and can be installed running:
To remove Julia package and it's dependencies (if not used by any other software on your system), you can run:

#### Arch Linux

On Arch Linux, Julia is available from community repository, and can be installed running:
To remove Julia package and it's dependencies (if not used by any other software on your system), you can run:

#### Void Linux

On Void Linux distributions, Julia is available from main repository, and can be installed running:

#### Fedora

On Fedora distributions, Julia is available from the updates repository (a default repository) and can be installed running:
To remove Julia package and its dependencies (again, if not used by other software on your system), you can run:
Note that this applies only to Fedora, downstream distributions such as RHEL or CentOS must check their own repositories to see if Julia is available.

### Running a script with Julia

To tell your operating system that it should run the script using Julia, you can use what is called the shebang syntax. To do this, just use the following line on the very top of your script:
With this as the first line of the script, the OS will search for "julia" on the path, and use it to run the script.