title: Errno::EACCES: Permission denied when running bundle and it hits json 1.8.1, pg 0.17
body: <p>I just got a new laptop and fully transferred everything using Migration Assistant.  It seems like everything works normally and is in its proper place, so I don't know if that's the issue.  I'm still pretty new to debugging environment errors like this.</p>
  
  <p>I've been developing a rails project on Windows and this laptop is a Mac OS X 10.8.  I've cloned a GitHub project onto it before and it ran fine.  Here's the <a href="https://github.com/mpron/soundtrackshare" rel="nofollow">github repo</a> for reference.  This project hits an error when I run bundle </p>
  
  <p>The Error</p>
  
  <pre><code>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.
  </code></pre>
  
  <p>Ruby Gem Env</p>
  
  <pre><code>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 =&gt; true
       - :verbose =&gt; true
       - :backtrace =&gt; false
       - :bulk_threshold =&gt; 1000
    - REMOTE SOURCES:
       - https://rubygems.org/
  </code></pre>
  
  <p>My Path</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Tried adding this to my gemfile</p>
  
  <pre><code>gem 'json', '1.8.0'
  </code></pre>
  
  <p>Now I get this new error after bundle update json... My last project did Postgres only in production too, but I didn't see the pg gem when I bundle that one.</p>
  
  <pre><code>You have requested:
  </code></pre>
  
  <p>json = 1.8.0</p>
  
  <pre><code>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 `&lt;main&gt;'
  
  
  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.
  </code></pre>
  
  <p>Any clues?</p>