How I Got Started Setting Up Elixir

Written by

I am so impressed with Elixir, it really is remarkable and worthy of the hype. Elixir’s creator, @josevalim, is a seriously clever fella and also quite a charasmatic teacher as proven on Meet Elixir. I thought I would write a short post on the steps I personally took to getting Hello, World! output from an Elixir script in SublimeText3, my editor of choice. The getting started page for Elixir covers installation, however, I like to document specific steps for my future reference which others may find of use.

NOTE: Change installation paths as desired.

Install Erlang

I use Boxen and therefore simply added the erlang puppet module.

Alternatively follow instructions to install Erlang as detailed on the getting started page of Elixir.

Install Elixir

I followed Elixir’s compile from source installation instructions as follows:

  • cd /usr/local/lib/
  • git clone https://github.com/elixir-lang/elixir.git
  • cd elixir
  • make test

Setup SublimeText

  • cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/
  • git clone git://github.com/elixir-lang/elixir-tmbundle Elixir.tmbundle
  • vim ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/Elixir.tmbundle/elixir.sublime-build
  • I edited the build file as follows to manually resolve the build path:

      {
          "cmd": ["/usr/local/lib/elixir/bin/elixir", "$file"],
          "selector": "source.elixir"
      }
    
  • Restart SublimeText3

Quick build test

  • echo 'IO.puts "Hello, World!"' > ~/src/newtriks-dev/elixir/hello.exs
  • Open ~/src/newtriks-dev/elixir/hello.exs in SublimeText
  • Build the file ⌘ + B

You should see the build window in SublimeText display

Hello, World!
[Finished in 0.3s]

Now watch Meet Elixir on PeepCode and grab the beta ebook Programming Elixir: Functional |> Concurrent |> Pragmatic |> Fun by @pragdave.

Comments