所以我刚刚从ubuntu交换到mac,设置env并没有像承诺那么容易.
这是我遵循的过程.
>安装xcode – 然后进入prerences并下载命令行工具
>然后通过运行gcc -version来验证是否安装了正确的版本
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) Copyright (C) 2007 Free Software Foundation,Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>然后安装homebrew $ruby -e“$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)”
运行酿造医生,这是我得到的
你的系统已经准备好了.
安装git brew update brew install git
通过ssh将我的电脑连接到我的git帐户
安装Rbenv
$brew update $brew install rbenv $brew install ruby-build
将eval“$(rbenv init – )”添加到我的.bash_profile文件中
>运行rbenv install -list查看我可以安装的所有版本,然后运行
$rbenv install 1.9.3-p327 $rbenv global 1.9.3-p327
(我应该rehashed rbenv但我忘了)然后我运行gem安装捆绑包
>然后进入我的一个repo的,并运行捆绑安装,有错误
Gem::InstallError: better_errors requires Ruby version >= 1.9.2. An error occurred while installing better_errors (0.7.0),and Bundler cannot continue. Make sure that `gem install better_errors -v '0.7.0'` succeeds before bundling.
跑了ruby -v,看到它是1.8.7“球” – 我惊呼
>补救这个我做了以下rbenv rehash
> ruby -v并得到红宝石1.9.3p327(2012-11-10修订版37606)[x86_64-darwin12.3.0]然后高兴自己
>然后尝试运行bundle,同样的错误出现?
$which bundle /usr/bin/bundle $which gem /Users/fortknokx/.rbenv/shims/gem
所以这是现在我站起来困惑的地方.正如我所说,这是我第三天使用mac,我很了解理解$PATH,我相信我在某处犯规.任何建议我开放.
ps这是我在.bash_profile中的
export PATH="/usr/local/bin:/usr/local/bin/sublime:~/bin:$PATH" eval "$(rbenv init -)"
解决方法
问题似乎是你使用系统ruby安装的bundler,而不是一个rbenv ruby安装.
运行ruby –version来确保你的rbenv ruby是活动的,然后运行gem install bundler,然后是rbenv rehash,然后尝试重新安装你的gem,看看是否有效.