Lazy man’s way to add precompiled Elixir on OS X


So, I’ve been a big Erlang fan for a few years now, and then found out about Elixir:  what I would describe as kind of a Ruby-ish creamy frosting on top of Erlang. But I’ll address more on both in future. Right now, I thought I’d just give a quick and dirty way to add Elixir, if you’ve already got Erlang installed (hint: check-out this Erlang Solutions link for a pre-compiled Erlang solution).  You can also use brew to install both, but I have found that with the simplicity of brew, you give up having the most current version of software.  In both cases.

The pre-compiled zip for the most current version of Elixir can be found here.  Unzipping reveals a folder containing everything you need.  For simplicity’s sake, keeping everything pertaining to Elixir all within this folder makes the most sense.  By doing so, all that’s needed is to position the folder, and then make links to all the executables in a directory already in our path.  Through the link, the OS will find the program, and everything the program needs (libs and such) are already where it expects to find them (in the folder).

Rename the folder to: “Elixir“.  The reason I do this is so that I can easily find it later, and just drag the old folder to the trash, replacing it with whatever the current version is (and not have to change any of the links– drag and drop replacement).


NOTE:  the following assumes that you have “/usr/local/bin” on your path.


Now, move (mv) the newly renamed folder to the directory: “/usr/local/“, so that the final directory path is now, “/usr/local/Elixir“.

Again from the terminal, change directories (cd) to “/usr/local/bin”, as it’s from here that we’re going to set every thing up to play nice.

With the current directory in the terminal now, “/usr/local/bin” add the following soft links to each of the Elixir executables (beginning ‘$’ represents the terminal prompt in all examples):


$ ln -s /usr/local/bin/iex  iex

$ ln -s /usr/local/bin/elixir  elixir

$ ln -s /usr/local/bin/elixirc  elixirc

$ ln -s /usr/local/bin/mix  mix

Now, you can double check everything:


$ iex -v
$ elixir -v
$ elixir -v
$ mix -v

Provided everything is set up correctly, and you received version number’s from each command, you’re ready to rock with Elixir.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s