Rails on Mac OS X 10.5 (Leopard to most people), is fantastic. It’s already there, and it just works. From the very second Leopard finishes installing, you can run
rails yourAppName in a terminal, and boom, it gives you a default Rails app. Move into the directory that just got created with
cd yourAppName, and start Mongrel running with
script/server. Fire up Safari, head on over to http://0.0.0.0:3000/, and you can see your app running. Awesome!
However, try and move this to a non OS X server, and it won’t work, because
/public/dispatch.rb all have the following line at the top:
This line should say:
This change that Apple have made isn’t necessary for Rails to run on OS X, as there’s already a symlink in
/usr/bin/ruby to make this extra code unnecessary. I’m a little confused by Apple’s motives here. A mistake? A mischevious way of increasing OS X Server sales, by making it harder for people to port their apps away from OS X? Either way, it’s an unneeded frustration. Fix it, Apple!
4 thoughts on “Annoying bug with Rails on Mac OS X 10.5 (Leopard)”
I don’t understand what the fuss is about.
so you recompile it to run under linux like you would if you wrote it in C, and the compiler takes care of the difference between osx/bsd/linux/solaris whatever so you don’t have to.
What am i missing here?
While I see your point, I’m not sure it’s worth worrying about. I’d even go so far as to say it might actually be a good thing. I think Apple’s reasoning behind using the full system path is because a replacement ruby install (from fink, for example) would almost certainly replace the symbolic link and that would kill your application, which would be far worse.
Also, people moving their application to Linux will typically know that they need to check the first line of a cgi script to make sure the path is correct.
Looks like they are targeting a particular version of Ruby in the path which is sensible enough, I’d attribute it to a (unwanted) feature rather than a bug or maliciousness.
Valid points, and I’m hoping it’s not deliberate, but either way it’s annoying, heh. If other OSes that bundle Rails themselves (Ubuntu, Debian, Fedora, etc) can supply un-tampered packages, surely Apple can? It should be portable out of the box like it is elsewhere.