labria’s ruby blog

random ruby/rails stuff

Mac OS X Lion and Ruby (or, NoRuby)

4 comments

I've installed the Lion DP twice. Once (DP1) as an upgrade to Snow Leopard, and the second time on a clean partition.

You can surely find all about Lion in the interwebs (it rocks, except some quirks), so I'll just rant about one thing that is interesting to me: Lion and Ruby.

First, about DP1 over SL. Everything was fine, all the installed rubies continued working smoothly, no trouble whatsoever. Too bad I had to reformat and give that MBP away.

Then came the clean DP2 install. In short: it was a mess. Sadly, I didn't keep logs of my attempts to make it right, but I guess anyone can relive it and publish the logs and errors, if they want to. I went through about 5 to 10 attempts to install ruby and some gems, all failed, until reality caught on with me and I had to reboot back to SL to get my work for the day done.

First, about Lion and gcc. By default you don't get one. XCode4.0 doesn't install, only XCode4.1DP. Somehow, XCode3.2.3 is also installable (not that it helped a lot). So you end up with gcc-4.2 with LLVM (and Clang for whatever reason), not being able to compile much.

System ruby: 1.8.7 p200something. Well, I don't recall anyone working with the system ruby installation seriously, but this got worse, because they forgot to include ruby dev headers and so no binary gems for you. (I guess this should be fixable, I just didn't try).

RVM REE: The installer failed, telling me it kinda missed zlib and openssl. That was quite strange, I was used to the system providing it (and homebrew doesn't even have a formula for zlib). Manual compilation failed with something printing out the ree version and segfaulting.

RVM 1.9.2: Compilation failed with a stack too deep error.

Hombrew 1.9.2: Compilation failed with some _mach_something_ not found somewhere.

MacRuby did a good job. It installed fine, compiled all the gems and just after that failed with some incompatibility between it and the JSON gem (a bit on that later).

JRuby was the best: it installed, compiled the gems, and even gave me a result for "knife node list". A bit later it failed on "knife cookbook upload" and I gave up.

As a conclusion, a few small pieces of advice: don't try Lion on you work box, and if you wanna try it, install it as a upgrade. While I'm sure there's a way to make everything work, expect it to take some time. And don't believe people saying 20Gb is enough for Lion. 30 was barely enough for Lion+Xcode + some minor stuff.

A sidenote on json. As you may know, there are two json libraries: json, and json_pure (a pure-ruby implementation, as the name suggests). While it's perfectly OK to depend on the 'json' gem, please, do not require it using "gem 'json'", use "include 'json'" instead. Because the first form is unable to use the json_pure replacement, which can be quite useful if you can't use the binary one. Be kind to the less fortunate ones (and Solaris people, IIRC).

Written by labria

April 3rd, 2011 at 8:38 pm

Posted in Ruby

4 Responses to 'Mac OS X Lion and Ruby (or, NoRuby)'

Subscribe to comments with RSS or TrackBack to 'Mac OS X Lion and Ruby (or, NoRuby)'.

  1. Did you mean “require ‘json’” in last paragraph?

    kaineer

    6 Apr 11 at 07:40

  2. Hopefully this helps with your compilation errors – http://stephen-baldwin.tumblr.com/post/4345008417/mac-osx-10-7-lion-and-ruby-1-9-2

    Stephen

    7 Apr 11 at 05:24

  3. Thanks, Stephen! Do binary gems and stuff like openssl compile well?

    labria

    9 Apr 11 at 12:27

  4. @kaineer of course I did. It’s just that I see too much python at work =)

    labria

    19 Apr 11 at 16:50

Leave a Reply