Posts Tagged DevRig

Setting up an Erlang Rig on Windows

In January I posted that I was diving into Linux full-time for my Erlang work. Erlang RigErlang itself runs great on Windows, Linux and Mac. I made the shift because most Erlang developers work in Linux and I felt I was probably missing something with my Windows-centric approach. This turned out to be a very valuable exercise. I tried out ErlIDE (Eclipse), a tricked out gedit, Vim, and Emacs. In the end, the best-paved and most productive path for Erlang development appears to be Emacs tricked-out with Erlang goodies and a console standing by for running Rebar and Git commands.

Here’s what my Erlang rig consists of:

  • Emacs 23.3
    • Erlang mode : Provides syntax highlighting,
    • Flymake: shows warnings and errors on the fly as you type like visual studio
    • IDO: Adds a good way to browse directories and open files
    • color-theme: adds pretty colors and fonts
    • Distel: theoretically provides auto-completion, step through debugging and other goodies.
    • Key mappings: Adds the key bindings for Cut,Copy,Paste,Alt-F4, Ctrl-Tab that a red-blooded Windows expects.
  • Rebar
  • Git

A few months in, I realized all of these things should work just fine on Windows. Today I have the same Erlang development rig on both Windows and Linux. This makes me very happy. Why? I’ve mentioned this in previous posts, but I believe C# and Erlang are great complements. Even in a Windows-only .NET shop with no appetite for introducing Linux, there’s no reason to take Erlang off the table. Having a proper Windows tool-chain for Erlang development moves the discussion away from an OS holy war and back to a cost-benefit analysis of Erlang itself. That’s a good place to be.

Each time I’ve done my “Intro to Erlang for C# Developers” talk, folks see my Windows Emacs rig in action and ask “What’s involved in getting that to work?” For anyone who is interested here are the steps:

Get Erlang R14B03

  1. Download Erlang from here.
  2. Run the otp_win32_R14B03.exe setup file. By default the installer wants to put Erlang here “C:\Program Files\erl5.8.4″ but change that to “C:\erlang\erl5.8.4\”. OK, but why? Most of the tools and scripts you will use for Erlang development on Windows were crafted over on Linux and the authors may not have tested for spaces in the path (e.g. “Program Files”). Remove that risk.
  3. Add “C:\erlang\erl5.8.4\bin” to your PATH.

Get Emacs 23.3

  1. Download Emacs 23.3 from here.
  2. Right click the zip and “Unblock” it.
  3. Extract it to a sensible location such as “C:\utility\emacs-23.3″. Again avoid spaces in the path to avoid unnecessary pain.
  4. Add “C:\utility\emacs-23.3\bin” to your PATH.
  5. Add an environment variable named “HOME” and give it the value of your home directory (for me this is “C:\Users\bryanhunter”)
  6. Run Emacs. When it loads it should have a white background, a homely font, and the most hideous splash screen you’ve ever seen.
  7. Close Emacs.

Pull down my Emacs configuration files [updated 8/27/2011]

  1. Visit my GitHub repository named ErlangRigEmacsConfig
  2. Read the readme file
  3. Download the zip of the repository. This repository contains the “.el” (Emacs Lisp) files that turn plain old Emacs into something pretty nice for Erlang development.
  4. Right click the zip and unblock it
  5. Extract it into your home directory (for me this is “C:\Users\bryanhunter”). Note: this needs to match what you put in the HOME environment variable under the Emacs steps.
  6. Edit your “~/.emacs” file to something like this:

If all went well, when you open Emacs it will show a nice black background screen. If you (or I) missed something, you will see the hideous default Emacs splash screen.

Extra credit #1: Use a prettier font

  1. Download the lovely “DejaVu” font family from here.
  2. Unblock the zip and extract it somewhere.
  3. Open up the “dejavu-fonts-ttf-2.33\ttf\” directory.
  4. Select all the TTF files and drag them into your “C:\Windows\Fonts” directory.
  5. Open the “my-config.el” file (it’s in your fancy new Emacs configuration directory).
  6. Find the line that reads “:family “Consolas”" and replace “Consolas” with “DejaVu Sans”.
Extra credit #2: Start learning Emacs Lisp
  1. Open the “my-config.el” file (it’s in your shiny new Emacs configuration directory).
  2. Read it top-to-bottom.
  3. Tinker, save your changes, reload Emacs.
  4. Read the “Programming in Emacs Lisp” guide  (here) to get smarter.
  5. GOTO 3

[Note: this post will be in flux until it is correct and complete. Please comment to help me get it there.]

Tags: ,


Installing Erlang R14B03 on Ubuntu 11.04

In January I said I would post instructions on installing the latest Erlang on the latest Ubuntu. Apparently organized people can write major updates to both operating systems and to languages faster than I can write a single paragraph in WordPress. Sigh... Ubuntu is now at 11.04 and Erlang is at R14B03 (just released today!). To make up for being a slacker, here’s a script (a github gist) to install Erlang 14B03 on a fresh install of Ubuntu 11.04:

It’s not as pretty as “apt-get install erlang”, but unfortunately apt-get will give you R13B03 which was released way back in Nov 2009 (five releases ago). If you spot anything silly let me know. For what it’s worth it works on my machine… : )

Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.4  (abort with ^G)

Tags: , ,


I, n00b: At the border-crossing from C# to Erlang (on Ubuntu)

I’m a C# .NET developer. I have spent most of the past 18 years in Windows. I’ve played around with various Linux distros, but it’s really been hobby stuff. Another hobby over the past three years has been learning Erlang. Until recently I’ve used the Windows builds of Erlang and it’s been fun and easy.

I’m now on a full-time Erlang project and have realized my Windows-centric approach to Erlang development is adding lots of friction to “going pro”. Erlang runs perfectly well on Windows, but most of the Erlang community develops on Linux (or Mac). As a result, the developer tool-chain is much more complete in Linux. As I learn I’m constantly translating to Windows what the experts are saying and doing in Linux, and occasionally I hit dead ends. It’s been a challenge, but not the fun, worthwhile kind. So now I’m learning how to be an all-day-in-it Erlang developer on Linux (Ubuntu 10.10). I’ve had many newbie questions and I’m attempting to document them.  I plan to post answers as I stumble across them (e.g.- I’m currently piecing together a post on “Upgrading Erlang to 14B01 on Ubuntu 10.10″ ).

I have a professional goal of being able to fluidly shift between C#, Ruby, F# and Erlang on both Windows and Linux. Bigotry and partisanship aren’t pretty anywhere– not even in technology. I’m aiming to not have favorites or default answers, but instead to pick the best tool for the situation. It’s going to hurt a bit, but I think on the other side of this journey I’ll be a happier, smarter and more useful developer. And really what’s the alternative? Complacency? To acknowledge there are better ways to do what I’m doing, but that I’m too much of a “sorry ass” to get there? Please, heavens, no.

I’d be curious to hear from other folks who have made (or are embarking on) this journey.

Tags: , , , ,