Errno :: EACCES:运行bundle时权限被拒绝,它命中json 1.8.1,pg 0.17

我刚买了一台新笔记本电脑,并使用Migration Assistant完全转移了所有内容。 看起来一切正常并处于适当的位置,所以我不知道这是不是问题。 我仍然是调试这样的环境错误的新手。

我一直在Windows上开发一个rails项目,这台笔记本电脑是Mac OS X 10.8。 我之前已经克隆了一个GitHub项目,它运行良好。 这是github回购以供参考。 当我运行bundle时,这个项目会出错

错误

Using rake (10.1.0) Using i18n (0.6.1) Using multi_json (1.8.2) Using activesupport (3.2.13) Using builder (3.0.4) Using activemodel (3.2.13) Using erubis (2.7.0) Using journey (1.0.4) Using rack (1.4.5) Using rack-cache (1.2) Using rack-test (0.6.2) Using hike (1.2.3) Using tilt (1.4.1) Using sprockets (2.2.2) Using actionpack (3.2.13) Using mime-types (1.25) Using polyglot (0.3.3) Using treetop (1.4.15) Using mail (2.5.4) Using actionmailer (3.2.13) Using arel (3.0.2) Using tzinfo (0.3.38) Using activerecord (3.2.13) Using activeresource (3.2.13) Using bundler (1.3.5) Using rack-ssl (1.3.3) TheInstalling json (1.8.1) Errno::EACCES: Permission denied - /Users/user/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/.gitignore An error occurred while installing json (1.8.1), and Bundler cannot continue. Make sure that `gem install json -v '1.8.1'` succeeds before bundling. 

Ruby Gem Env

 Users-MacBook:soundtrackshare user$ gem env RubyGems Environment: - RUBYGEMS VERSION: 2.0.6 - RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [x86_64-darwin12.3.0] - INSTALLATION DIRECTORY: /Users/user/.rvm/gems/ruby-2.0.0-p247 - RUBY EXECUTABLE: /Users/user/.rvm/rubies/ruby-2.0.0-p247/bin/ruby - EXECUTABLE DIRECTORY: /Users/user/.rvm/gems/ruby-2.0.0-p247/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-darwin-12 - GEM PATHS: - /Users/user/.rvm/gems/ruby-2.0.0-p247 - /Users/user/.rvm/gems/ruby-2.0.0-p247@global - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - https://rubygems.org/ 

我自己的路

 Users-MacBook:soundtrackshare user$ echo $PATH /Users/user/.rvm/gems/ruby-2.0.0-p247/bin:/Users/user/.rvm/gems/ruby-2.0.0-p247@global/bin:/Users/user/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/user/.rvm/bin:/usr/local/bin:/usr/local/sbin:~/bin:/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin 

尝试将此添加到我的gemfile中

 gem 'json', '1.8.0' 

现在我在捆绑更新json之后得到了这个新错误…我的最后一个项目也只在生产中做了Postgres,但是当我捆绑那个时我没有看到pg gem。

 You have requested: 

json = 1.8.0

 The bundle currently has json locked at 1.8.1. Try running `bundle update json` Run `bundle install` to install missing gems. Users-MacBook:soundtrackshare user$ bundle update json Fetching gem metadata from https://rubygems.org/........... Fetching gem metadata from https://rubygems.org/.. Resolving dependencies... Using rake (10.1.0) Using i18n (0.6.1) Using multi_json (1.8.2) Using activesupport (3.2.13) Using builder (3.0.4) Using activemodel (3.2.13) Using erubis (2.7.0) Using journey (1.0.4) Using rack (1.4.5) Using rack-cache (1.2) Using rack-test (0.6.2) Using hike (1.2.3) Using tilt (1.4.1) Using sprockets (2.2.2) Using actionpack (3.2.13) Using mime-types (1.25) Using polyglot (0.3.3) Using treetop (1.4.15) Using mail (2.5.4) Using actionmailer (3.2.13) Using arel (3.0.2) Using tzinfo (0.3.38) Using activerecord (3.2.13) Using activeresource (3.2.13) Using bundler (1.3.5) Using rack-ssl (1.3.3) Using json (1.8.0) Using rdoc (3.12.2) Using thor (0.18.1) Using railties (3.2.13) Using rails (3.2.13) Using acts-as-taggable-on (2.4.1) Using atomic (1.1.14) Using bcrypt-ruby (3.1.2) Using sass (3.2.12) Using bootstrap-sass (2.3.2.2) Using cancan (1.6.10) Using coffee-script-source (1.6.3) Using execjs (2.0.2) Using coffee-script (2.2.0) Using coffee-rails (3.2.2) Using orm_adapter (0.4.0) Using thread_safe (0.1.3) Using warden (1.2.3) Using devise (3.1.1) Using faker (1.2.0) Using jquery-rails (3.0.4) Installing pg (0.17.0) Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /Users/user/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb checking for pg_config... yes Using config values from /usr/bin/pg_config *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/Users/user/.rvm/rubies/ruby-2.0.0-p247/bin/ruby --with-pg --without-pg --with-pg-config --without-pg-config --with-pg_config --without-pg_config --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/ /Users/user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /Users/user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0' from /Users/user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:534:in `try_link' from extconf.rb:39:in `' Gem files will remain installed in /Users/user/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.17.0 for inspection. Results logged to /Users/user/.rvm/gems/ruby-2.0.0-p247/gems/pg-0.17.0/ext/gem_make.out An error occurred while installing pg (0.17.0), and Bundler cannot continue. Make sure that `gem install pg -v '0.17.0'` succeeds before bundling. 

有什么线索吗?

您可能需要安装Xcode控制台工具,至少这是我遇到的问题。

你可以通过运行:

 xcode-select --install 

有关更多信息,请参阅此链接

在小牛队上安装Rails