Installing and compiling Elixir and the Dynamo web framework on Windows

Installing and compiling Elixir and the Dynamo web framework on Windows.

Introduction

People following me on twitter noticed I got entangled in yet another new language for the Erlang/BEAM VM:

Elixir could be easily described as "ruby for the BEAM/Erlang VM". In previous posts, I mentioned why people should learn Erlang, but in fact, I think most people might be better off when they skip Erlang and opt directly for Elixir. It has all the advantages of Erlang, but offers a Ruby-like syntax, macros, polymorphism and more.

In this post, I will show you how to get started with Elixir and generate a template website using the Dynamo web framework.

Installing Elixir is simple, but because one of the Dynamo web framework dependencies requires the make tool, you need to do some extra work. If anybody finds a better/simpler way to do this, please let me know in the comments.

Prerequisites

In order to get started with Elixir on windows, you need several apps installed:

Minimal system from Minimalist GNU for Windows (also installed with Chocolatey: cinst mingw ) - make sure you install the mingw developer toolkit - see screenshot:

Next you need to make sure that "erlang/bin", "elixir/bin" and "MinGW\bin" are in your path, and we will verify that everything works; we will also need to copy the file "c:\mingw\bin\mingw32-make.exe" to "c:\mingw\bin\make.exe". Next we can test whether everything works:

Getting and building the web framework for Elixir: Dynamo

Dynamo is a web framework tailored specificly to the Elixir language. As it is written on top of the Erlang Cowboy/Ranch stack, it uses proven technology to accelerate web development.

Anyway, enough background; let us get started with the installation...

First we need to clone the dynamo repo(which is a web framework that has a workflow comparable to Ruby on Rails) and build it. You can get it using the following command: "git clone https://github.com/elixir-lang/dynamo.git".

Because building the dependency Cowboy requires the make.exe tool (the reason we needed to install MinGW MSys), we need to do this in an msys shell. You can find the msys shell under "c:\mingw\msys\1.0\msys.bat".

Open up the shell, clone the repo and get/build the dependencies from dynamo using the mix tool : "mix deps.get".

You will get an error in the end, but that is not really a problem; the compilation should be succesful. Now you need to compile the dynamo app: "mix compile"

Generate a web app with dynamo: blah

You can now test whether dynamo works. You can now use dynamo to generate a web app: "mix dynamo [path of app]"

This has created a web-app in the blah folder. We go to the blah folder, and run once again "mix deps.get" and "mix compile". Then we should be able to start the server by typing "mix server".