Today I’ve switched from the default, C based implementation of Ruby to new version of IronRuby (1.0). After installation I wanted to update gems, install rake tool and of course at this point problems started. Command for updating gems displayed below:
igem update --system
produced output like this:
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.3.6
Updating RubyGems to 1.3.6
Installing RubyGems 1.3.6
ERROR: While executing gem ... (Gem::Exception)
[BUG] invalid exec_format "ir", no %s
After some research turned out that RubyGems assumes that Ruby executable contains “ruby” word in the name. In case of IronRuby the name is “ir.exe” so in my opinion this strange behavior can be treated as a bug in RubyGems. I hope it will be fixed in next release but before that will happen here are the steps to workaround the problem and update gems:
1. Create path: [IronRuby folder]\Lib\ruby\1.8\rubygems\defaults
2. Create file ironruby.rb and add it to the path from step 1
3. Open ironruby.rb and add code from the snippet below
module Gem
def self.default_exec_format
exec_format = ConfigMap[:ruby_install_name].sub('ruby', '%s') rescue '%s'
#unless exec_format =~ /%s/ then
# raise Gem::Exception,
# "[BUG] invalid exec_format #{exec_format.inspect}, no %s"
#end
exec_format
end
end
That is it. Now RubyGems will use new implementation of default_exec_format and everything should work as expected.
Hope this helps.
[...] This post was mentioned on Twitter by Marcin Obel, Pawel Lesnikowski. Pawel Lesnikowski said: Haha FAIL: RT @marcinobel: Blogged: [BUG] invalid exec_format “ir”, no %s http://bit.ly/9AtM1D #ruby #ironruby #gems [...]
Perhaps a better solution would be to replace self.default_exec_format with the following:
def self.default_exec_format
exec_format = ConfigMap[:ruby_install_name].sub(‘ir’, ‘%s’) rescue ‘%s’
unless exec_format =~ /%s/ then
raise Gem::Exception,
“[BUG] invalid exec_format #{exec_format.inspect}, no %s”
end
exec_format
end
[...] = 'hotgazpacho';After reading this article on getting around the invalid exec_format “ir”, no %s issue when trying to update RubyGems in [...]