Remember, I used gem install rails to install Rails, but today, when I want to install another stone, typing
gem install ruby-recaptcha
he fails saying:
You do not have permission to write to ...
Then I found that my gem environment and sudo gem environment have different results:
For gem environment :
RubyGems Environment: - RUBYGEMS VERSION: 1.8.15 - RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [x86_64-darwin11.0.1] - INSTALLATION DIRECTORY: /Users/hx/.rvm/gems/ruby-1.9.2-p290 - RUBY EXECUTABLE: /Users/hx/.rvm/rubies/ruby-1.9.2-p290/bin/ruby - EXECUTABLE DIRECTORY: /Users/hx/.rvm/gems/ruby-1.9.2-p290/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-darwin-11 - GEM PATHS: - /Users/hx/.rvm/gems/ruby-1.9.2-p290 - /Users/hx/.rvm/gems/ ruby-1.9.2-p290@global - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - :gempath => ["/Users/hx/.rvm/gems/ruby-1.9.2-p290"] - :sources => ["http://rubygems.org/"] - REMOTE SOURCES: - http:
For sudo gem environment :
- RUBYGEMS VERSION: 1.8.15 - RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [x86_64-darwin11.0.1] - INSTALLATION DIRECTORY: /Users/hx/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1 - RUBY EXECUTABLE: /Users/hx/.rvm/rubies/ruby-1.9.2-p290/bin/ruby - EXECUTABLE DIRECTORY: /Users/hx/.rvm/rubies/ruby-1.9.2-p290/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-darwin-11 - GEM PATHS: - /Users/hx/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1 - /Users/hx/.gem/ruby/1.9.1 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - :gempath => ["/Users/hx/.rvm/gems/ruby-1.9.2-p290"] - :sources => ["http://rubygems.org/"] - REMOTE SOURCES: - http:
It is noted that the installation directory is different. So when I use gem , I donβt have permissions (I donβt know why I suddenly lost permission). But when I use sudo gem , the gem does not set in the right place. How can i fix this?
Hanxu source share