Accidentally nuked my Rails installation - what do I need to do to recover?
I seem to have broken my Rails installation on Mac OS 10.6.7. Here's the status:
MacBook-Pro$ which ruby
/usr/local/bin/ruby
MacBook-Pro$ which gem
/u开发者_C百科sr/local/bin/gem
MacBook-Pro$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.5.0]
MacBook-Pro$ gem -v
1.8.5
I use homebrew to manage these packages:
MacBook-Pro$ brew list
distribute libyaml ossp-uuid python sqlite
gdbm mongodb pip readline wget
git mysql postgresql ruby
My ~/.profile has this:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
Before this ordeal started, I used
sudo gem install rails
I just ran it again and got this:
MacBook-Pro$ sudo gem install rails
Password:
Successfully installed rails-3.0.9
1 gem installed
Installing ri documentation for rails-3.0.9...
file 'lib' not found
Installing RDoc documentation for rails-3.0.9...
file 'lib' not found
But when I run:
which rails
I get nothing in return.
I think at some point I went into /usr/bin/ which is I think the "which rails" pointed to in order to see what was in the rails file. And I think I may have deleted this file. (Yes, I'm an idiot.)
It looks like I somehow need to connect the location of the rails gem with the OS so that it knows it's there? Or can/should I nuke the whole installation? I'd appreciate any guidance!
This might be a good time to switch to using rvm.
https://rvm.io
Try with gem install with -V option, maybe you'll see where it's installing everything. It installs rails for me in /Library/Ruby/Gems/1.8/gems/rails-3.0.9/bin/rails and /usr/bin/rails. It's hacky but you could copy rails from the first location to the second if it doesn't automatically add for you. Best idea is probably to nuke it and start fresh.
精彩评论