Fresh Blurbs

Julia CLI on Mac OS-X

Julia is one of those "next-generation" languages that have gained a lot of spotlight. It's a specialized language targeted at "technical computing" i.e. things you would normally do in Fortran or R. Except, as opposed to Fortran, it is a modern, dynamic language with parallelism and distributed computing support built right into its core. Thanks to Julia's outstanding JIT compiler: it is significantly faster than R, even in a non-distributed environment.

Julia is very easy to install. On OS X (my development platform of choice) you can simply download a DMG installer and be done in a single click. Compared to complex installation procedures of some of the other programming languages — this is great.

However, by default, when you install Julia DMG you are left to having to launch a separate Julia app for CLI. This wasn't sitting well with me: I want to use Julia in my own terminal, on my own terms (obviously!) and be able to write/run shell scripts using Julia interpreter.

To get all of that done, you need to put the following line in your shell startup script (e.g. in ~/.bash_profile) which adds Julia's executable to your shell's path:

export PATH="/Applications/$PATH"

Note: Julia-0.3.3 is the latest at the time of this writing, replace with the version you actually end-up installing.

Once you have added Julia to your path, you will be able to run Julia interpreter directly in your terminal of choice by simply typing julia and you can write shell scripts seamlessly, using following syntax:

#! /usr/bin/env julia
# Hello.jl

println("Hello World");
comments powered by Disqus