Erlang on Mac OSX

April 28, 2008

On a fresh install of Leopard, the following is what I did in order to set up Erlang working on my Mackbook Pro:

1. Download Xcode by going to Apple ADC. Xcode is the Apple’s developer tool set, and its available for free. At the time of my install, the latest is Xcode 3.0 and its little over 1 GB. Double-click the downloaded file (named xcode_3.0.dmg), and follow the graphic package installer. This will install Xcode under /Developer by default. This step is required for Erlang because it will install GCC compiler required to build Erlang from source.

2. Get the latest Erlang source, which will be a file named otp_src_R12B-2.tar. Unarchive the file and follow the instructions:

$ cd otp_src_R12B-2
$. /configure
$ make
$ sudo make install

Now bring up a terminal and issue the command:

$ erl

Erlang (BEAM) emulator version 5.6.2  [smp:2] [async-threads:0] [kernel-poll:false]
Eshell V5.6.2  (abort with ^G)
1>2+3.
5
2>;

I am all set to go…

15 Comments on Erlang on Mac OSX

Respond | Trackback

  1. MIGUEL says:

    Thank you so much!!! just what i needed

  2. Thadeu Carmo says:

    Amazing! tnks!

  3. lee Barney says:

    Once you have erlang installed there is an Xcode plugin that you can use to build your applications. Go to https://sourceforge.net/projects/quickconnect/ 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 http://tetontech.wordpress.com/2009/08/13/quickconnecterlang-now-available-for-os-x/

  4. admin says:

    @lee Thats super-awesome. Thanks for letting me know!

  5. tommy höglund says:

    thanks a lot. Help me a bunch

    best regards

    tommy

  6. Farhad Khan says:

    Thanks, worked like a charm!

  7. Prashanth says:

    Hey there,

    Are you having any trouble getting two local erlang nodes to talk to each other? I start up two erlang nodes (erl -sname c1 and erl -sname c2) in c1, i cannot seem to do a net:ping(c2@myhostname), it always returns pang.

    Thanks

  8. Simon N Goodwin says:

    Tried this on OSX 10.4.11 (dual G4s, build system type powerpc-apple-darwin8.11.0) with latest Erlang R13B03 but I get:

    checking for broken gcc-4.3.0 compiler… yes
    configure: error: This gcc miscompiles the Erlang runtime system; please use a different version
    configure: error: /bin/sh ‘/Users/simon/build/otp_src_R13B03/erts/configure’ failed for erts

    Oh well, I’ll see if I can find an un-broken compiler for my aged but emphatically not broken Mac… pity, but kudos to the config writers for catching this and reporting in the script.

  9. Simon N Goodwin says:

    Turns out my Mac came with XCode 2.0. Getting the 2.5 version from Apple’s dev site moved gcc back to 4.0.1 (eh?!) and that satisfied .configure, though it did complain that wx (optional portable GUI stuff) was not available and that it was not going to build docs as ‘fop is missing’ – however recent source comes with pre-built docs so that shouldn’t matter. :-)

    Apple hide versions of Xcode for systems other than the flavour of the month (x86 and 10.6 ‘snow leopard’) but clear instructions to find the older ones are here:

    http://www.dvhardware.net/software/10313

    Then let it run the fan for a bit, ignoring “warning: pointer targets in passing argument 1 of ‘sprintf’ differ in signedness” and ilk (C wasn’t designed, like PCs aren’t) but this is a Proper Build Script by a wizard for true Gnu so it makes its stately way to

    === Leaving application dialyzer[install]done

    bin/erl

    “Erlang R13B03 (erts-5.7.4) [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

    Eshell V5.7.4 (abort with ^G)
    1> 0/0.
    ** exception error: bad argument”

    Result! 8-)

  10. t says:

    Thank you for short 5 line installation guide. Thank you

  11. Sony says:

    Thanks! worked well on my Snow Leopard.

  12. Demosthenes says:

    Works on Lion as well.

  13. Kritika says:

    Thanks a lot! It was a great help!
    I wonder if you ever tried installing oz on Mac? I tried and failed at it.
    Do let me know if you can help me with it.

  14. Geronimo says:

    Thanks a lot! Worked fine on Mountain Lion except for getting the GCC running for the command line. You will need to download and install the command line tools in Xcode 4.4 in the prefs.

  15. Matthew says:

    Awesome! If after installing xcode, gcc is still not in the path. In Xcode go to Xcode -> Preferences -> Downloads and install command line tools.

Respond

Comments

Comments