我是终端的初学者,我想学习 Rails。我有一台装有 Lion 10.7.5 的 Mac。我想安装 Rails,它似乎已安装,然后当我输入 rails -vi 时收到此消息:
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
所以我去堆栈溢出,看到很多人有同样的问题。所以我尝试了人们推荐的东西,但都没有奏效。然后我做了一个不明智的决定来删除 ruby2.1.1 以便重新安装它:
brew install ruby
在这里开始混乱:
Warning: You seem to have osx-gcc-installer installed.
Homebrew doesn't support osx-gcc-installer. It causes many builds to fail and
is an unlicensed distribution of really old Xcode files.
Please install the CLT or Xcode 4.6.3.
我已经有 Xcode 4.6.3
Warning: It appears you have MacPorts or Fink installed.
不知道该怎么办
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
Warning: ruby-2.1.1 already installed
所以我输入:rvm use ruby 2.1.1
我得到了:
Warning! PATH is not properly set up, '/Users/me/.rvm/gems/ruby-2.1.1/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.1.1'.
ruby-2.1.1 is not installed.
To install do: 'rvm install ruby-2.1.1'
所以我做到了,我得到了:
Downloaded archive checksum did not match, archive was removed!
If you wish to continue with not matching download add '--verify-downloads 2' after the command.
Downloading https://rvm.io/binaries/osx/10.7/x86_64/ruby-2.1.1.tar.bz2 failed.
和
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-O3 -
I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --
prefix=/Users/me/.rvm/rubies/ruby-2.1.1 --disable-install-doc --enable-shared',
showing last 15 lines of /Users/me/.rvm/log/1397387601_ruby-2.1.1/configure.log
谢谢你,如果你能帮助我不知道该怎么办知道
ps:其他测试:ruby -v 我搞定了
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0]
rvm 列表
Warning! PATH is not properly set up, '/Users/me/.rvm/gems/ruby-2.1.1/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.1.1'.
rvm 使用 ruby-2.1.1
ruby-2.1.1 is not installed.
回声 $PATH
/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/local/bin:/opt/local/sbin:/Users/me/.rvm/gems/ruby-2.1.1/bin:/Users/me/.rvm/gems/ruby-2.1.1@global/bin:/Users/me/.rvm/rubies/ruby-2.1.1/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin:/Users/me/.rvm/bin:/Users/me/.rvm/bin:/Users/me/.rvm/bin
哪个红宝石
/usr/bin/ruby
rvm 卸载 ruby-2.1.1
Warning! PATH is not properly set up, '/Users/me/.rvm/gems/ruby-2.1.1/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.1.1'.
ruby-2.1.1 - #removing src/ruby-2.1.1..
ruby-2.1.1 - #removing default ruby interpreter............
和我的 .bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# Load RVM into a shell session *as a function*
PATH=$PATH:$HOME/.rvm/bin source "$HOME/.rvm/scripts/rvm"
最后是我的 .bashrc
export PATH="/usr/local/heroku/bin:$PATH"
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
source "$HOME/.rvm/scripts/rvm