Installing Elixir and Phoenix framework on Windows 10

posted on 2016-03-13

Since December I’m using a Windows 10 based tablet/convertible Asus T100HAN. It is small and neat device and my first tablet I can sensibly code on while commuting, waiting at doctor’s office and the like. Which is great, you know :-)

Below I wrote all the steps required to get Elixir and Phoenix framework running on such low-end device or any other with Windows 10.

First install Chocolatey if you haven’t already. It is a great package manager. Can’t compare it to homebrew, the quality isn’t there yet but it is the best there is on Windows.

So launch command prompt as Administrator any type:

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

Restart the command prompt or run another one and install Elixir:

choco install elixir -version 1.2.3 -y

It will also install Erlang as a dependency. Unfortunatelly the way the package adds Elixir binaries to path variable doesn’t work on Windows 10 so you need to add “C:\ProgramData\chocolatey\lib\Elixir\bin” manually to your system’s path.

Update: From version 1.2.3.03182016 it is no longer necessary to manually add Elixir to system’s path, Elixir chocholatey maintaner Onorio Catenacci have fixed this issue and now it works great.

Launch another console and type “iex” to check if Elixir interactive shell is working. You can exit it with Ctrl+C.

Now let’s install Phoenix framework. With newly launched console run:

mix local.hex
mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez

Now we’ll install also optional dependency for phoenix, namely brunch.io which uses node.js so we need to get it first. We’ll use Chocolatey to installed it. Remember to run console always as Administrator when you use choco or npm.

choco install nodejs.install -y

and then with one more new console:

npm install -g brunch

You can now also install PostgreSQL with Choco as Elixir will use it as a default database with: choco install postgresql

The default password set by Chocolatey is “Postgres1234”, but to easy the pain of configuring Ecto by hand change it to the default password ecto uses, ie. ’postgres’ (of course this only applies to a development environment).

Run PostgreSQL shell from new console:

psql -U postgres

and alter the password, then quit:

ALTER USER Postgres WITH PASSWORD 'postgres';
\q

And that’s all. Now you have Elixir and Phoenix installed to play with. Now I urge you to get Spacemacs which have built-in support for Alchemist, a great Elixir development environment, and start fiddling with it 😄

And if you install it all on a low budget Windows 10 tablet like me, here are the final size requirements on your primary partition:

325Mb  Erl
5Mb    Elixir
25Mb   Node.js
177Mb  Postgresql
-----------------
532Mb

Happy hacking!