这是交易:
$ gem -v
1.3.7
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [x86_64-darwin10.4.0]
- INSTALLATION DIRECTORY: /Users/harriett/.rvm/gems/ruby-1.9.2-p0@rails3tutorial
- RUBY EXECUTABLE: /Users/harriett/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
- EXECUTABLE DIRECTORY: /Users/harriett/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-10
- GEM PATHS:
- /Users/harriett/.rvm/gems/ruby-1.9.2-p0@rails3tutorial
- /Users/harriett/.rvm/gems/ruby-1.9.2-p0@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
$ sudo env ARCHFLAGS =“ - arch i386”gem install mysql - --with-mysql-config = / Applications / MAMP / Library / bin / mysql_config
Building native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
$ gem list mysql
* LOCAL GEMS *
为什么不显示?
当然,当我在ruby程序中需要“mysql”时,我得到:
`require': no such file to load -- mysql (LoadError)
答案 0 :(得分:2)
您的Ruby安装由RVM管理。请参阅RVM站点上的“DO NOT use sudo...”。
尝试在没有 sudo
的情况下安装,它应该出现在你的gemlist中。