Search code examples
ruby-on-railsrubygemsmp3id3id3lib

RubyGems: no such file to load using mp3info


I'm trying to read the duration out of an mp3 file using ruby-mp3info and my test.rb file currently looks like this:

require "rubygems"
require "mp3info"

# read and display infos & tags
Mp3Info.open("audiofile.mp3") do |mp3info|
  puts mp3info
end

However, when I run ruby test.rb I get the error:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- mp3info (LoadError)

I'm on a Mac running Snow Leopard, and other that running sudo gem install ruby-mp3info this is a pretty basic install. id3lib-ruby looks like a possible alternative, however the Mac install seems a bit more involved.

Is there an easy way to fix the mp3info install or otherwise get the duration of an mp3 file?

Thanks! Peter


Solution

  • Try running gem install ruby-mp3info without the sudo.