How to Make a New Chicago Boss App on OSX Mavericks

So I’ve recently found the interest to learn Erlang. Being a web developer I immediately tried to find a web framework to try it out in, because that’s how I learn best. It wasn’t long until I found Chicago Boss. Soon after that I found that it wasn’t immediately clear and simple how to even get started but after some quick research I got started. Here’s a post to help you save 5 minutes. Hopefully.

First thing is we assume you already have Homebrew.

Install Erlang

Now you may think that this is simply to brew install erlang but it isn’t quite that simple. At the time of writing, Chicago Boss does not support the latest Erlang (R16B03) that is in homebrew. So you’ll have to install an older version.

Commands
1
2
cd $( brew --prefix )
brew versions erlang
Output
1
2
3
4
5
6
7
R16B03-1 git checkout e8e033e Library/Formula/erlang.rb
R16B03   git checkout a1ade14 Library/Formula/erlang.rb
R16B02   git checkout 8fcac01 Library/Formula/erlang.rb
R16B01   git checkout 2178b33 Library/Formula/erlang.rb
R15B03-1 git checkout 8759d6c Library/Formula/erlang.rb
R16B     git checkout 7ab778a Library/Formula/erlang.rb
R15B03   git checkout 311472d Library/Formula/erlang.rb

What you want is R16B02, so in this case you just fire off

git checkout 8fcac01 Library/Formula/erlang.rb

And then brew install erlang. After that is completed you’re welcome to git reset HEAD and then git checkout . to put things back in their places and make sure you don’t run into anything in the future when you’re trying to update Homebrew

Install Chicago Boss

I chose to grab the latest and greatest from Github for this. Go into where you are intending of placing your Erlang code

Commands
1
2
3
4
5
6
7
git clone git@github.com:ChicagoBoss/ChicagoBoss.git
cd ChicagoBoss
./rebar get-deps
./rebar compile

make app PROJECT=first_app
cd ../first_app

Start writing your first lines of Erlang code!

src/controllers/first_app_pages_controller.erl
1
2
3
4
5
-module(first_app_pages_controller, [Req]).
-compile(export_all).

index('GET', []) ->
  {output, "<h1>Hello World</h1>"}.

Then fire up the web server

Commands
1
./init-dev.sh

Then see your great work at http://localhost:8001/pages/index

Comments