Clean slate install Rails

2019-05-24 14:08发布

问题:

Father, I've done terrible things. I've messed my system up completely. It all started back when I tried to make Rails to use the same MySQL that my MAMP PRO uses. ( I still haven't managed them to work together).It ended badly, and just keeps getting worse.

The latest error message:

➜  ~  rails        
/Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
    from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1208:in `gem'
    from /Users/hb/.rvm/gems/ruby-1.9.3-p0/bin/rails:18:in `<main>'

So I have decided, that I should probably just wipe the system clean of my RVM and Rails installations and then re-install everything in a single proper way (currently I've experimented with different approaches, including installing rails gem as sudo, without sudo, and with RVM). This all mess is very confusing, and I have no idea how did I even pull it off (to mess everything up).

Anyhow - can someone please tell me how to do a clean wipe on all gems, so there wouldn't be any trace of rails on my system, so I can perform a clean install. Also, what would be best way to install rails on Mac OS X Lion. Should or shouldn't I use RVM, if I am intending only to use the latest version of Ruby and Rails ?

I don't want to just forget about the gems in my system if I were to use rvm, as once in a while I run into problems when accidentally using sudo or not. I think it is best just have one and that's it.

Cheers.

回答1:

Here's an article showing how to remove all gems, but be careful!

Then, here are a set of commands to perform a clean install of ruby 1.9.3 and rails 3.2 without RVM:

curl ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz -o ruby-1.9.3-p0.tar.gz
tar xvf ruby-1.9.3-p0.tar.gz
cd ruby-1.9.3-p0/
autoconf
./configure --program-suffix=19 --enable-shared --with-readline-dir=/usr/local
make && sudo make install

Then download the latest rubygems from here: http://rubyforge.org/frs/download.php/75711/rubygems-1.8.15.tgz

tar xvf rubygems-1.8.15.tgz
cd rubygems-1.8.15
sudo ruby setup.rb

And finally install rails

sudo gem install rails

Hope it helps!



回答2:

I was just having the same problem. I fixed mine by editing the Gemfile and changing

source 'https://rubygems.org'

-to-

source 'http://rubygems.org'