Ruby 1.8.6 and Rubygems 1.0.1 – “can’t activate xxx, already activated yyy’

Using ruby 1.8.6 and rubygems 1.0.1

If you get the error “can’t activate xxx, already activated yyy”, it can be hard to find the problem.

This version of custom_require.rb has some debug information that prints to the console to make this job easier.

This file updates the file of the same name in the directory

$RUBY_LIB_INSTALL_DIR/site_ruby/1.8/rubygems/custom_require.rb

where $RUBY_LIB_INSTALL_DIR is the base directory where internal Ruby libraries are stored for your particular installation. This is almost always either /usr/lib/ruby or /usr/local/lib/ruby.

In addition, in the following in the file:

$RUBY_LIB_INSTALL_DIR/site_ruby/1.8/rubygems.rb

Add an additional line so the code starting near line 12 looks like this fragment

  module Gem
    class LoadError < ::LoadError
      attr_accessor :name, :version_requirement
    end

    DEBUG_ME = true unless defined?(Gem::DEBUG_ME)
  end

Then, insert a statement similar to this at the start of the method ‘activate’ (near line 300).

puts "rubylib.rubygems activate gem #{gem.inspect} autorequire #{autorequire.inspect} version_requirements #{version_requirements.inspect}" if Gem::DEBUG_ME

OS X Leopard – Advanced User Settings

In OS X Leopart, ro access advanced user settings:

System Preferences > Accounts > Unlock > Control-Click on User Name > Advanced Settings

Rails and mini_magick

mini_magick is a gem that allows you to run ImageMagick in a shell rather that as part of your application. It replaces Rmagick.

To install

sudo gem install mini_magick

To use in your code

OS X Flush DNS Cache

To flush theĀ  DNS cache in OS X (as superuser):

lookupd -flushcache (Tiger)
dscacheutil -flushcache (Leopard and later)

WordPress Themes