labria’s ruby blog

random ruby/rails stuff

Archive for the ‘Ruby’ Category

Mac OS X Lion and Ruby (or, NoRuby)

5 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

Naglfar release

leave a comment

I finally found time in my schedule to release the Naglfar project. I've been thinking for a long time of a project to use the beautiful name, and I suddenly realized that the name itself is quite enough for me =)

To install, just do the usual:

gem install naglfar

The gem does almost nothing, actually. It declares the Naglfar singleton class with one useless method, and prints a message to stdout after you require it.

From now on, i'll require it in every ruby project I'll be doing. I do think that having a Naglfar in your project will bring it good luck, so don't hesitate to require it too!

PS: I plan to release something much more useful soon, so watch this space.

Written by labria

February 21st, 2010 at 10:54 pm

Posted in Ruby

Tagged with