How to install binary gem without the build step?

Vít Ondruch's Avatar

Vít Ondruch

06 May, 2011 12:34 PM


I need to install binary gem. However, the gem is not compatible with my platform, so I need to patch it before build. I would appreciate if there would be some way how to skip the build and build the binary extension later manually. This would allow to generate folder structure, documentation and the spec file as well as to prevent the error exit code of gem install


  1. 1 Posted by Luis Lavena on 06 May, 2011 12:49 PM

    Luis Lavena's Avatar


    There is no functionality for gem installation.

    However, you can do the following:

    gem fetch to download the gem package gem unpack to extract the gem

    Edit the gem to generate the modifications you need

    Then use gem spec and save the contents as gem.gemspec which you can use with gem build to regenerate the gem.

    But, I would recommend you reach our the gem author and collaborate to introduce the changes to the gem directly :-)

  2. Luis Lavena closed this discussion on 06 May, 2011 12:49 PM.

  3. 2 Posted by Luis Lavena on 06 May, 2011 12:50 PM

    Luis Lavena's Avatar

    Forgot to mention,

    From the generated gemspec, remove the extensions part so the new gem do not attempt to compile again.

  4. Vít Ondruch re-opened this discussion on 09 May, 2011 12:40 PM

  5. 3 Posted by Vít Ondruch on 09 May, 2011 12:40 PM

    Vít Ondruch's Avatar

    Thank you Luis, I am aware that something like the guide you have written is probably the way, but you see how many steps and hassle is required. Compare it with following fictional steps:

    gem install foo --skip-build
    cd /some/path/to/foo/ext
    apply some patch

    This ticket was aimed more to be RFE then request for the guide.

    I understand and fully support, that it is better to work with upstream to support my platform, but on the other hand, to help upstream to support my platform, it would be nice to have such feature in place. I can create RFE ticket somewhere, but not sure where. Probably Rubyforge?

  6. 4 Posted by Luis Lavena on 09 May, 2011 01:21 PM

    Luis Lavena's Avatar

    Well, actually that will not work.

    mkmf generates paths to be installed into site_ruby, not inside the gem, so make and make install will place the generated extension outside the gem itself. RubyGems patches the generated makefile to place the result in lib, something you will require to do manually.

    RubyGems tracker is here:

    It is mentioned in RubyGems README:

    I still recommend working with upstream.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac