The solution from Doc Snuggles really works.
But it should be noted that your gem command probably lives in a gemset, that is:
rvm info | grep gem
will tell you where the gem script lives.
Then edit it and add a magic line before any other require :
require 'resolv-replace'
source share