_
_ _ _(_)_ |
(_) | (_) (_) | A fresh approach to technical computing
_ _ _| |_ __ _ |
| | | | | | |/ _` | | http://julialang.org
| | |_| | | | (_| | | [email protected]
_/ |\__'_|_|_|\__'_| | #julia on freenode
|__/ |
Julia is a high-level, high-performance dynamic language for technical computing. The main homepage for Julia can be found at julialang.org. This is the GitHub repository of Julia source code, including instructions for compiling and installing Julia, below.
- Homepage: http://julialang.org
- Mailing list: http://groups.google.com/group/julia-dev/
- IRC: http://webchat.freenode.net/?channels=julia
- Source code: https://github.com/JuliaLang/julia
- Git clone URL: git://github.com/JuliaLang/julia.git
- Documentation: http://julialang.org/manual/
- GNU/Linux: x86/64 (64-bit); x86 (32-bit).
- Darwin/OS X: x86/64 (64-bit); x86 (32-bit).
- FreeBSD: x86/64 (64-bit); x86 (32-bit).
First, acquire the source code either by cloning the git repository (requires git to be installed):
git clone git://github.com/JuliaLang/julia.git
or, if you don't have git installed, by using wget and tar to fetch and unpack the source:
mkdir julia && wget -O - https://github.com/JuliaLang/julia/tarball/master | tar -zxf- -C julia --strip-components 1
Next, enter the julia/
directory and run make
to build the julia
executable.
When compiled the first time, it will automatically download and build its external dependencies.
This takes a while, but only has to be done once.
Note: the build process will not work if any of the build directory's parent directories have spaces in their names (this is due to a limitation in GNU make).
Once it is built, you can either run the julia
executable using its full path in the directory created above, or add that directory to your executable path so that you can run the julia program from anywhere:
export PATH="$(pwd)/julia:$PATH"
Now you should be able to run julia like this:
julia
If everything works correctly, you will see a Julia banner and an interactive prompt into which you can enter expressions for evaluation. You can read about getting started in the manual.
### Platform-Specific NotesOn some Linux distributions (for instance Ubuntu 11.10) you may need to change how the readline library is linked. If you get a build error involving readline, try changing the value of USE_SYSTEM_READLINE
in Make.inc
to 1
.
On Ubuntu, you may also need to install the package libncurses5-dev
.
If OpenBLAS fails to build in getarch_2nd.c
, you need to specify the architecture of your processor in Make.inc.
On OS X, you may need to install gfortran
. Either download and install gfortran from hpc.sf.net, or 64-bit gfortran from gcc.gnu.org.
On FreeBSD the prerequisites can be installed from ports like this:
cd /usr/ports/devel/gmake
make install
cd /usr/ports/ftp/curl
make install
cd /usr/ports/devel/libunwind
make install
cd /usr/ports/lang/gcc45
make install
ln -s /usr/local/bin/gfortran45 /usr/local/bin/gfortran
Other versions of gcc are also available but gfortran45 is the one use by all the ports that depend on fortran currently.
Use the gmake command on FreeBSD instead of make
## Required Build Tools & External LibrariesBuliding Julia requires that the following software be installed:
- GNU make — building dependencies.
- gcc, g++, gfortran — compiling and linking C, C++ and Fortran code.
- perl — preprocessing of header files of libraries.
- wget or curl — to automatically download external libraries (Linux defaults to
wget
, OS X and FreeBSD tocurl
).
With the exception of gfortran
, these are standard on most Linux systems and on any OS X system with Xcode
and Apple's Developer Tools installed.
Julia uses the following external libraries, which are automatically downloaded and compiled from source (or in a few cases, included in the Julia source repository) the first time you run make
:
- LLVM — compiler infrastructure. Currently, julia requires LLVM 3.0.
- FemtoLisp — Packaged with julia source, and used to implement the compiler front-end.
- GNU readline — library allowing shell-like line editing in the terminal, with history and familiar key bindings.
- fdlibm — a portable implementation of much of the system-dependent libm math library's functionality.
- MT — a fast Mersenne Twister pseudorandom number generator library.
- OpenBLAS — a fast, open, and maintained basic linear algebra subprograms (BLAS) library, based on Kazushige Goto's famous GotoBLAS.
- LAPACK — a library of linear algebra routines for solving systems of simultaneous linear equations, least-squares solutions of linear systems of equations, eigenvalue problems, and singular value problems.
- AMOS — Subroutines for computing Bessel functions and Airy functions.
- SuiteSparse — a library of linear algebra routines for sparse matrices.
- ARPACK — a collection of subroutines designed to solve large, sparse eigenvalue problems.
- FFTW — library for computing fast Fourier transforms very quickly and efficiently.
- PCRE — Perl-compatible regular expressions library.
- GMP - the GNU multiple precision arithmetic library, needed for bigint support
- D3 — JavaScript visualization library.
attic/ old, now-unused code
contrib/ emacs and textmate support for julia
examples/ example julia programs
external/ external dependencies
j/ source code for julia's standard library
lib/ shared libraries loaded by julia's standard libraries
src/ source for julia language core
test/ unit and function tests for julia itself
ui/ source for various front ends
Because of the rapid pace of development at this point, we recommend installing the latest Julia from source, but platform-specific tarballs with containing pre-compiled binaries are also available for download. To install from source, download the appropriate tarball and untar it somewhere. For example, if you are on an OS X (Darwin) x86/64 system, do the following:
wget https://github.com/downloads/JuliaLang/julia/julia-c4865bd18d-Darwin-i386.tar.gz
tar zxvf julia-c4865bd18d-Darwin-i386.tar.gz
You can either run the julia
executable using its full path in the directory created above, or add that directory to your executable path so that you can run the julia program from anywhere:
export PATH="$(pwd)/julia:$PATH"
Now you should be able to run julia like this:
julia
If everything works correctly, you will see a Julia banner and an interactive prompt into which you can enter expressions for evaluation. You can read about getting started in the manual.
## Editor & Terminal SetupJulia support is currently available for Emacs, Vim, and TextMate.
Support files and instructions for configuring these editors can be found in contrib/
.
Adjusting your terminal bindings is optional; everything will work fine without these key bindings.
For the best interactive session experience, however, make sure that your terminal emulator (Terminal
, iTerm
, xterm
, etc.) sends the ^H
sequence for Backspace
(delete key) and that the Shift-Enter
key combination sends a \n
newline character to distinguish it from just pressing Enter
, which sends a \r
carriage return character.
These bindings allow custom readline handlers to trap and correctly deal with these key sequences; other programs will continue behave normally with these bindings.
The first binding makes backspacing through text in the interactive session behave more intuitively.
The second binding allows Shift-Enter
to insert a newline without evaluating the current expression, even when the current expression is complete.
(Pressing an unmodified Enter
inserts a newline if the current expression is incomplete, evaluates the expression if it is complete, or shows an error if the syntax is irrecoverably invalid.)
On Linux systems, the Shift-Enter
binding can be set by placing the following line in the file .xmodmaprc
in your home directory:
keysym Return = Return Linefeed
Julia has a web REPL with very preliminary graphics capabilities.
Follow these instructions for setting up the web repl locally.
In external, doing make install-lighttpd
will download and build lighttpd.
Use the launch-webserver script to start the webserver and web-repl.
Point your browser to http://localhost:2000/
.
Try plot(cumsum(randn(1000)))
If you want to use your own lighttpd
, then the process is something like this:
-
Install
lighttpd
-
Configure
lighttpd
: The config file is/etc/lighttpd/lighttpd.conf
. Addmod_scgi
toserver.modules
. Setserver.document-root
to point to/path/to/julia/ui/website
. Add something like this to the bottom (you can use whatever port you want):scgi.server = (".scgi" => (("host" => "127.0.0.1", "port" => 2001)))
. -
Start lighttpd:
sudo /etc/init.d/lighttpd start
. -
Start the julia server:
path/to/julia/julia-release-webserver -p 2001
. -
Point your browser to
http://localhost:2001
.