ruby-on-rails - OS X Mavericks 破坏了 rbenv?

标签 ruby-on-rails ruby rbenv

最近,我安装了 OS X Mavericks,它似乎弄乱了我的开发环境。我在运行“rails new first_app”后收到此消息:

Your user account isn't allowed to install to the system Rubygems.
You can cancel this installation and run:

    bundle install --path vendor/bundle

to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to Rubygems using sudo.

Password: 
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.1)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.9.0)
Using atomic (1.1.15)
Using thread_safe (0.2.0)

Errno::EACCES: Permission denied - /Library/Ruby/Gems/2.0.0/build_info/tzinfo-0.3.39.info
An error occurred while installing tzinfo (0.3.39), and Bundler cannot continue.
Make sure that `gem install tzinfo -v '0.3.39'` succeeds before bundling.

然后我做了要求我做的事情:

christohersmbp2:hartl christopherspears$ gem install tzinfo -v '0.3.39'
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

奇怪的是我确实安装了 rbenv。事实上,在尝试调试这个问题时,我升级了 rbenv:

christohersmbp2:~ christopherspears$ brew update
Already up-to-date.
christohersmbp2:~ christopherspears$ brew upgrade rbenv ruby-build
Warning: A newer Command Line Tools release is available
Update them from Software Update in the App Store.
Error: rbenv-0.4.0 already installed
Error: ruby-build-20140225 already installed

但是,当我尝试从命令行调用 rbenv 时收到此错误消息:

christohersmbp2:hartl christopherspears$ rbenv
-bash: rbenv: command not found
christohersmbp2:~ christopherspears$ rbenv rehash
-bash: rbenv: command not found

我想我已经正确设置了路径:

christohersmbp2:hartl christopherspears$ echo $PATH
/usr/local/share/python:/Users/christopherspears/.rbenv/bin:/Users/christopherspears/bin:/usr/local/heroku/bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin

这是我的 .bash_profile 文件中的内容:

# rbenv stuff
export PATH="$HOME/.rbenv/bin:$PATH"
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

奇怪的是,我认为我在我的版本文件夹中使用的是 Ruby 版本:

christohersmbp2:versions christopherspears$ pwd
/Users/christopherspears/.rbenv/versions
christohersmbp2:versions christopherspears$ ls
2.0.0-p247/
christohersmbp2:versions christopherspears$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]

有什么提示吗?我似乎做的一切都是正确的。

更新:

我下载并安装了 Xcode 命令行工具。似乎没有用:

christohersmbp2:~ christopherspears$ rbenv -bash: rbenv: 找不到命令

最佳答案

正如@Christoper Spears 所说,卸载然后重新安装,或者更具体地说:

$ brew uninstall rbenv
$ brew install rbenv

(假设您首先使用 brew 安装它)。

关于ruby-on-rails - OS X Mavericks 破坏了 rbenv?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22338587/

相关文章:

ruby - rbenv 和 passenger - 无法从非 root 用户帐户(sudo 组)安装

ruby-on-rails - ruby rails : Using Parsely-Rails

javascript - 将 Ruby 正则表达式翻译成 JavaScript

ruby - 如何在 Curses 中获取 Shift+X/Alt+X 键?

ruby - 有点代码看不懂 RUBY = [*?a..?z]

ruby - Yosemite 升级后 Textmate 运行命令时出错

javascript - 'rake assets:precompile' 的时间性能差

ruby-on-rails - 如何在 Rails 中记录 API 请求?

ruby-on-rails - 在 rails 中使用 resque 调度程序时如何检查作业的状态?

ruby - 在 OS X 上使用 Homebrew 还是 ruby​​ 版本管理器?