Thursday, June 05, 2008

My Tryst with Erlang

Of late I have been trying to learn some new dynamic/functional languages. With all the noise about RoR(Ruby on Rails) in the last few years and changes it has brought to the web application development, it was natural to try my hands at Ruby/Rails. Being a REST enthusiast and Rails 2.0 providing support for RESTful Services, I have looked at implementing some services using rails.

In recent times there have been many debates on scalability of Rails applications and concurrency support of Ruby in general being fairly weak, I looked at different directions for a better language to adopt. The ones that had caught my attention in the last few months have been Erlang and Scala. Being a Java developer for the last several years it would have been easy for me to go for Scala. Scala is an OO and functional hybrid that runs on the JVM and has access to java libraries. It is like having the best of both worlds!

But I admit to have been smitten by Erlang for its simplicity, and a language written keeping in mind the basic non-functional requirements of an enterprise system (ex. Reliability, Availability, Concurrency and Scalability). Scala does have some of the key features of Erlang implemented (ex. Actor Libraries for concurrency) albeit in different ways, it still is not in the same league. In the same breath I have to admit that Scala would definitely be a good replacement for Java. This article from Yariv Sadan, an Erlang developer with ErlyWeb, Twoorl etc to his credit, is a great read on the differences beween Erlang and Scala. Steve Vinoski, an Erlang convert has also put down some of his thinkings in his blog.

Coming to my experiences with Erlang, I have been playing with it for a few weeks trying to understand the basic concepts and have written a few sample programs. I am quite impressed by its simplicity when it comes to concurrency, error handling etc. Being in the EAI consultancy for quite sometime I have also looked at some of the Integration Frameworks like RabbitMQ written in Erlang.

Last week I was trying to install Erlang in my MacBook and it was really a tough job. There are no direct OSX distributions of Erlang available. I had to install it using MacPorts and it took me some time to understand the concepts and install Erlang, Yaws (Web Server written in Erlang) and ErlyWeb (Rails type Web Framework written in Erlang) . Intially I had issues (Compiler Issue: can not create executables) with the XCode version (I had XCode 2.5 which is supposed to be compatible with both Tiger and Leopard) and I upgraded it to 3.0. After having gone through developing the first web application, I upgraded my OS to OSX 10.5.3 (the new leopard version). I have not been able to start Erlang in my MacBook now; it gives me this silly “Bus Error”.

I have seen this issue in the MacPorts forum. I hope they fix the issue quickly for me to be able to venture into the beautiful world of Erlang again.


Gleber said...

I'm not using Mac OS X myself, but i know that there's a lot of Erlang developers using Mac OS X. Feel free to ask for help on the Erlang-Questions mailing list:

And i'm sure you won't be disappointed after diving into Erlang world ;)

Steve Vinoski said...

MacPorts seem to cause more problems than they solve; I've always had trouble with them, so I avoid them. Just get the Erlang source and build and install it yourself. I first run configure like this:

configure --enable-threads --enable-smp-support --enable-kernel-poll --enable-threads --without-gd

and then build and install it like this:

sudo make install

(or you could do that in one step using only the second command if you like). This installs erlang into /usr/local. Piece of cake and no need to wonder how it was built, why it doesn't work on 10.5.3 (BTW, the one I built for myself as outlined above works, no problem), etc.

alexis said...

Sorry you have been having problems!

If you cannot get MacPorts to work please drop an email to

Another user story is described here:


Rabi said...


Thanks for the reply..

Initially I did try to install from the latest source tar ball (otp_src_R12B-2). But I was getting some errors like ... odbc : ODBC library - link check failed

Can someone confirm using R12B-2 with OSX 10.5.3??

Steve Vinoski said...

@Rabi: there are parts left out of the build if you don't have the required underlying libraries installed. The ODBC message isn't an error, it's simply saying that the underlying ODBC support isn't there so it will be left out. Ignore it.

I've been building Erlang from source on various versions of OS X for a couple years now, at least 3 or 4 different Erlang releases, and they've all worked fine.

Rabi said...

Thanks Steve for the inputs.. Indeed these errors can be ignored.. I now have R12B-2 running on leopard.

Steve Vinoski said...

@Rabi: just in time for R12B-3! :-)

Rajesh J Advani said...

Have you tried running Rails on Java 1.6 using the scripting support? I'm curious about whether the new API really allows other languages to take advantage of the scalability and performance advantages of the Java platform.

Lee Barney said...

Once you have erlang installed there is an Xcode plugin that you can use to build your applications. Go to and download the QuickConnectFamily installer. Run it and you will find that there are two Erlang Projects now available to you. The first is a standard erlang app and the other uses the QuickConnectErlang framework.

Both of these run your application within Xcode and all output is directed to the Xcode console. When you are done developing your application it can be run from the commandline like any other application. The plugin even includes a bash script you can use to execute your app.

For more information go to