我遇到了osx-trash的以下错误。
我在ruby 1.9.3dev(2011-09-23修订版33323)[x86_64-darwin12.2.0]
$ gem install osx-trash
Successfully installed osx-trash-1.0.0
1 gem installed
Installing ri documentation for osx-trash-1.0.0...
Installing RDoc documentation for osx-trash-1.0.0...
$ touch foo
$ trash foo
/Users/vng/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- osx/cocoa (LoadError)
from /Users/vng/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/vng/.rvm/gems/ruby-1.9.3-rc1/gems/osx-trash-1.0.0/bin/trash:35:in `<top (required)>'
from /Users/vng/.rvm/gems/ruby-1.9.3-rc1/bin/trash:19:in `load'
from /Users/vng/.rvm/gems/ruby-1.9.3-rc1/bin/trash:19:in `<main>'
from /Users/vng/.rvm/gems/ruby-1.9.3-rc1/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/vng/.rvm/gems/ruby-1.9.3-rc1/bin/ruby_noexec_wrapper:14:in `<main>'
什么是osx / cocoa?
答案 0 :(得分:0)
该模块正式称为RubyCocoa,它是Mac OS X的框架,允许使用面向对象的脚本语言Ruby进行Cocoa编程。
通常RubyCocoa应该出现在/ System / Library / Frameworks中。
可能在升级ruby之后,他们忘记了cocoa绑定,所以尝试将ruby升级到最新版本,或者版本之间存在一些不一致。
您可以尝试通过ruby 1.8重新安装osx-trash,例如:
sudo ln -s /Library/Ruby/Gems/1.8/gems/rubygems-update-1.8.12/bin/gem /usr/bin/gem18
sudo gem18 install osx-trash
请参阅:
如果没有,请尝试通过gem重新安装cocoa(我不确定它是否是正确的可可,或者是newcocoa,还是其他东西):
gem uninstall cocoa
gem install cocoa --verbose
如果没有帮助,要启用RubyCocoa的安装,您需要在Ruby安装期间设置一些标志:
rvm install 1.8.7 --debug --reconfigure -C --enable-shared=yes
然后尝试从sources:
配置和安装RubyCocoa$ wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.0/RubyCocoa-1.0.0.tar.gz/download
$ tar xzf RubyCocoa-1.0.0.tar.gz && rm RubyCocoa-1.0.0.tar.gz && cd RubyCocoa-1.0.0
$ ruby install.rb config --target-archs="i386 x86_64 ppc"
$ # Or: # ruby install.rb config --target-archs="x86_64"
$ # Or: # ruby install.rb config --build-universal=yes
$ ruby install.rb setup
$ sudo ruby install.rb install
现在检查您安装的RubyCocoa版本:
ruby -r osx/cocoa -e “p OSX::RUBYCOCOA_VERSION”
如果不起作用,请检查以下内容: