Montag, 17. Januar 2011

Installing Io on my Mac

Currently I'm reading Seven Languages in Seven Weeks by Bruce Tate. The frist new language to learn is Io, a prototype based language. So I installed it on my Mac running Snow Leopard.
These instructions are not by an expert, but just describes the way it worked for me. If you have any suggestions or improvements feel free to add a comment.

The easiest way to install Io is by using Homebrew.
brew install io
If you want the lastest version from github you can alternatively install Io by hand.

First we need CMake, a cross platform make tool. Download the OS X version and install it.

Update: If you want to use the Socket Addon, you must also install libevent.
sudo port install libevent
or use a the corresponding command if you want to install it with Homebrew.

Then we need the lastest version of Io from github. Unpack it and change to that directory, then issue the following commands:
mkdir build && cd build
cmake ..
sudo make install
This will install libraries to /usr/local/lib and add the commands to /usr/local/bin: io and io_static. Then we're ready to test Io's VM with:
io ../libs/iovm/tests/correctness/run.io
If you get an error like this:
dyld: Library not loaded: libbasekit.dylib
  Referenced from: /usr/local/bin/io
  Reason: image not found
Trace/BPT trap
Then we have to show the linker the way to the libraries:
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/lib
export DYLD_LIBRARY_PATH
I added these two lines to my .profile.

After that you should be ready to get started.
io
Io 20090105
Io> "Hello Io" print
Hello Io==> Hello Io


Update: After playing around with Io, I wanted to try out the Socket Addon. But I got this error:
Io> Socket

  Exception: Object does not respond to 'Socket'
  ---------
  Object Socket                        Command Line 1
The missing libevent library was the cause for this error. Io doesn't complain about it, when compiling, but just skips the addon.

Keine Kommentare: