1

I just upgraded my Mac OS X to 10.5. Everything works great after a little Apache love, except for ruby and rails. This is what I am seeing

Macintosh:~ TAmoyal$ ruby test.rb 
-bash: /usr/local/bin/ruby: cannot execute binary file

Macintosh:bin TAmoyal$ file ruby
ruby: Mach-O executable i386

Macintosh:~ TAmoyal$ ruby
-bash: /usr/local/bin/ruby: cannot execute binary file

Macintosh:~ TAmoyal$ rails
/usr/local/bin/rails: line 9: require: command not found
/usr/local/bin/rails: line 11: version: command not found
/usr/local/bin/rails: line 13: syntax error near unexpected token `('
/usr/local/bin/rails: line 13: `if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then'

However, the ruby in /usr/bin/ruby seems to work fine. That is not the one getting used.

I obviously have to get ruby working before rails works. I couldn't find much help googling the ruby issue. I am not really even sure what OS X is telling me.

Any suggestions?

Thanks!

3 Answers 3

2

/usr/bin/ruby test.rb should use the 10.5 system installed Ruby interpreter. Since you upgraded, I would reinstall your non-system version of Ruby, instructions.

0

You were probably not using the bundled ruby version on Tiger, now that you have upgraded to Leopard the provided ruby has taken precedence in the path. The most obvious symptom of this is your gems (which are hard coded with the path of the ruby interpreter that they were installed against) will be missing.

You've either hand installed ruby, or used something like fink.

My recommendation is to install MacPorts, then install ruby, and rb-rubygems ports, then make sure that /opt/local/bin preceeds /usr/bin and /usr/local/bin

0

The Leopard (Apple) version of ruby comes with the developer tools. You'll see that in the the getting started part of the rails site. Just follow the install with gem update rails. Though I think I had to do some extra step like gem update generally to get everything working.

ALSO since you've installed rails on 10.? and presumably fixed ruby in the process (but not for 10.5, since if you were at <10.3.9 you'll find it's not binary compatible with 10.5), you may, or may not need to remove the binary. On my 10.5.x machine, ruby (from the dev tools) lives in /usr/bin/ not /usr/local/bin/.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .