Erlang Dev Environment
This tutorial is aimed at a Windows user looking to start with erlang, it will help you set up an effective development environment, without proper tooling erlang seems underpowered. After all you wouldn't write java code in notepad.
Install Ubuntu on VirtualBox
Save yourself some time early on and just use linux for erlang development. Erlang does work on windows but most testing of the SDK, open source libraries and tools gets done on linux so things just seem to go more smoothly in this environment.
Download VirtualBox and a supported version of Ubuntu. Install VirtualBox and create a new virtual machine using the Ubuntu ISO.
Install VirtualBox guest additions
Guest additons lets you full screen the virtualised Ubuntu and have it use shortcuts that currently get handled by windows like
alt+tab. Click the
Devices->Install Guest Additions VirtualBox menu. Once restarted the full screen and seamless menu itens should be enabled.
Install some tools
Just some tools no one should be without.
sudo apt-get install git vim htop
Making VirtualBox fly
Your VBox might still be slow. Try running
htop from the terminal, if it only has one CPU bar then you may need to enable virtualisation in your BIOS, which is pretty easy. The tutorial here. Once that's done, add more cores in the VBox system CPU settings.
Install erlang using the following command from askubuntu...
sudo apt-get install erlang erlang-doc
This may install an old version but it's super quick and will get you up and running. Check that the install was successful...
rebar is the maven of the erlang world, it can handle dependencies and standardises projects.
cd /usr/bin wget https://github.com/rebar/rebar/wiki/rebar
The rebar command is now on your path, try testing it from your home directory...
cd ~ rebar
Installing Gnome 3
Ubuntu defaults to the Unity interface. While I quite liked the aesthetics and the usability wasn't a problem I couldn't get hardware acceleration to work, this made the interface extremely slow and the text quite blurry. Instead use Gnome 3, text is crisp and the UI is relatively snappy. Once installed using the instructions below, remember to enable 3D acceleration in the VirtualBox settings...
Install sublime text 2
There is patchy support (my opinion only) in IDEs for erlang so don't expect anything like JDT tooling, although we can still use powerful tools. sublime text is just one editor with plugins to support erlang.
SublimErl is the sublime text plugin for erlang, have a look at the project page for the feature list.
In sublime text click on the
Preferenced->Browse Packages menu, this opens up a file explorer window. Right click on the Pacages button and
copy the path, then in a terminal type
cd, paste the path and press enter. Then use the following command...
git clone https://github.com/ostinelli/SublimErl.git
sublime text will automatically find this new plugin. There are a few things to remember when using SublimErl...
- It only handles projects in the rebar format. In sublime text the project is the directory in the left hand pane, add a directory using the menu
Project->Add Folder to Project...
- SublimErl looks for an ebin directory or rebar.config file to identify the root dir of the project so make sure to call
rebar compilein the project so it can be identified.
- sublime text 2 packages are not like eclipse plugins, they are entirely hackable. If you are curious, open the python code for the plugin and put some
print "Hello World"statements in there, sublime text will see the change instantly and hot-load the new code. You can see the output in the console, look for console in the cammand palette