【问题标题】:I deleted ruby 2.1.1 cannot install it again mac os 10.7.5我删除了 ruby​​ 2.1.1 无法再次安装 mac os 10.7.5
【发布时间】:2014-05-27 08:32:42
【问题描述】:

我是终端的初学者,我想学习 Rails。我有一台装有 Lion 10.7.5 的 Mac。我想安装 Rails,它似乎已经安装,然后当我输入 rails -v 时,我收到了这条消息:

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.

所以我去堆栈溢出,看到很多人有同样的问题。所以我尝试了人们推荐的东西,但都没有奏效。然后我做了一个不明智的决定,删除了 ruby​​2.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 使用 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

【问题讨论】:

  • /Users/me/.rvm/gems/ruby-2.1.1/bin 放在路径的第一位。你使用 zsh 还是 bash?
  • 嗨,当我这样做时它回答:-bash: /Users/me/.rvm/gems/ruby-2.1.1/bin: 是一个目录所以我想我使用 -bash
  • 你在做别人的事......只需在你的 shell 初始化脚本中添加:PATH=$PATH:$HOME/.rvm/bin,然后将 source "$HOME/.rvm/scripts/rvm" 添加到它的末尾。
  • 好的,谢谢,我试试。谢谢
  • 我在 /Users/me 的 .bashrc 文件中有 "PATH=$PATH:$HOME/.rvm/bin" 和 "source "$HOME/.rvm/scripts/rvm"。然后我重新启动 rvm install ruby​​ 2.1.1 并遇到同样的错误。感谢您的帮助

标签: ruby macos installation osx-lion reinstall


【解决方案1】:

问题出在你的.bash_profile的最后一行,请按如下方式更改,然后重试:

[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile 
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

PATH=$PATH:$HOME/.rvm/bin

【讨论】:

  • 我确实用你的文本替换了,然后当我运行 rvm install ruby​​-2.1.1 时,我得到了与以前完全相同的错误。
  • PATH 中混杂了一些东西,我们需要找出到底是什么。请使用 .bashrc 更新帖子
  • 这不是错误,只是警告。在它下面是命令的有效文本
  • 我刚刚用 .bashrc 更新了它。我不知道当我在终端中输入 /etc/profile 时提供输出是什么意思,我必须“sudo”它,否则权限被拒绝sudo: /etc/profile: command not found
  • 现在我迷路了,我做了一些愚蠢的事情。我找到了一个旧的 railsinstaller 卸载程序并启动它。现在我有一个消息-bash: /etc/profile.d/sm.sh: No such file or directory -bash: /etc/profile.d/rvm.sh: No such file or directory
猜你喜欢
  • 2013-11-08
  • 2012-12-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多