How run a RoR application using a custom Ruby installation?
On my Mac Os running Snow Leopard 10.6.5 I successfully installed Ruby 1.9.2 performing these steps so that, in the Terminal, I have these results:
$ ruby -v
ruby 1开发者_如何学JAVA.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0]
$ which ruby
/usr/local/bin/ruby
Now, when I run my RoR application and I get an error (in my case a "SocketError"), I have the following RoR "Framework Trace":
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:560:in `initialize'
...
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:772:in `get'
activeresource (3.0.1) lib/active_resource/connection.rb:112:in `send'
...
that means my RoR application is still running on the previous version of Ruby (v1.8.7)!!!
How can I run my RoR application using my new Ruby installation (v 1.9.2)?
P.S. I: all my RoR applications are located in /usr/< my_mac_account_name >/Sites directory
P.S. II: I am using Phusion Passenger
Not a solution for this particular problem, but you should really really use RVM to manage your Ruby installations. That's the easiest way to be sure you're using X version of Ruby (and thus it's related gems). Then you can switch between versions like this:
rvm use 1.9.2 #begin using Ruby 1.9.2
I suspect that your phusion passenger was built against the system Ruby, not the one you've got in /usr/local. Rebuild phusion Passenger but modify the path in the environment you're building phusion in.
On a linux:
export PATH=/usr/local/bin:$PATH
Not precisely sure of the PATH settings for Mac machines.
Reference: http://www.modrails.com/documentation/Users%20guide%20Apache.html#_preparation_gem_and_source_tarball_only
精彩评论