2

I am encountering the following error with osx-trash.

I am on ruby 1.9.3dev (2011-09-23 revision 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>'

What is osx/cocoa?

kenorb
  • 155,785
  • 88
  • 678
  • 743
xjq233p_1
  • 7,810
  • 11
  • 61
  • 107

1 Answers1

0

The module is known officially as RubyCocoa which is a framework for Mac OS X that allows Cocoa programming in the object-oriented scripting language Ruby.

Normally RubyCocoa should be present in /System/Library/Frameworks.

Probably after upgrading your ruby, they forgot about the the cocoa binding, so try to upgrade your ruby to the latest version or there is some inconsistency between the versions.

You may try to re-install osx-trash by ruby 1.8, e.g.:

sudo ln -s /Library/Ruby/Gems/1.8/gems/rubygems-update-1.8.12/bin/gem /usr/bin/gem18
sudo gem18 install osx-trash

See:


If not, try re-installing cocoa via gem (I'm not sure if it's the right cocoa, or newcocoa, or something else):

gem uninstall cocoa
gem install cocoa --verbose

If won't help, to enable installation of RubyCocoa you’ll need to set a few flags during Ruby installation:

rvm install 1.8.7 --debug --reconfigure -C --enable-shared=yes

Then try to to configure and install RubyCocoa from the sources:

$ 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

Now check which version of RubyCocoa you have installed:

ruby -r osx/cocoa -e “p OSX::RUBYCOCOA_VERSION”

If won't work, check the followings:

Community
  • 1
  • 1
kenorb
  • 155,785
  • 88
  • 678
  • 743