错误:执行gem时...(Gem :: FilePermissionError)

时间:2016-11-02 09:08:32

标签: ruby rubygems rbenv ruby-2.3.1

我正在尝试将rbenv设置为与fastlane一起使用。我按照here的说明操作。我已经安装了rbenv

rbenv install 2.3.1

然后更新它,以便版本指向:

rbenv local 2.3.1 => 2.3.1 (set by /Users/pepe/Development/test-ios/.ruby-version)

然后我尝试安装bundler:

gem install bundler并收到以下错误:

ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

以下运行给我:

rbenv which gem /Users/pernillau-ext/.rbenv/versions/2.3.1/bin/gem

which gem /Users/pernillau-ext/.rbenv/shims/gem

显然rbenv指向一个gem的安装,系统(Mac OS X 10.116)附带预安装的ruby和gem,它们安装在/Library/Ruby/Gems/2.0.0目录中。那么,我在这里错过了什么?为什么gem命令使用了错误的版本。

编辑:

我的bash_profile: export ANDROID_HOME=/Users/pepe/Library/Android/sdk export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home export GEM_PATH=/Users/pepe/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0 export PATH=$PATH:/Users/pernillau-ext/Library/Android/sdk/tools:/Users/pernillau-ext/Library/Android/sdk/platform-tools PATH="$(perl -e 'print join(":", grep { not $seen{$_}++ } split(/:/, $ENV{PATH}))')" eval "$(rbenv init -)"

1 个答案:

答案 0 :(得分:0)

尝试一点$PATH中的事情。将rbenv移动到$PATH

的前面 你的shell中的

$PATH看起来应该像(伪代码):

{rbenv shims} : {rbenv bin} : {system paths}