# RubyGems post-install hook

**URL:** <https://www.ruby-forum.com/t/rubygems-post-install-hook/99263>\
**Category:** Ruby\
**Created:** [July 21, 2006, 10:32am UTC](https://www.ruby-forum.com/t/rubygems-post-install-hook/99263 "2006-07-21T10:32:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [July 21, 2006, 10:32am UTC](https://www.ruby-forum.com/t/rubygems-post-install-hook/99263/1 "2006-07-21T10:32:42Z")

</div>

Hi,

I’m trying to package a Ruby library using Gems but have run into the  
problem of needing to execute some post-install commands a la setup.rb.  
Searching the archives brought this up from Dec 2004:

[http://makeashorterlink.com/?N1E21217D](http://makeashorterlink.com/?N1E21217D)

Am I right in thinking that RubyGems doesn’t support these kind of  
post-install hooks? Are there any plans to in the future?

As a proof of concept I knocked together a hacked rubygems which uses  
the SerializableProc class from Ruby Q. 38  
([Ruby Quiz - SerializableProc (#38)](http://www.rubyquiz.com/quiz38.html)) to allow something like this to  
work:

require ‘rubygems’

spec = Gem::Specification.new do |s|  
s.name = “test”  
s.version = “0.2.1”  
s.summary = “A test”

#…yadda…yadda…

#This proc gets stored in the gem and called after installation  
s.post\_install\_proc =  
SerializableProc.new %q{ system(“echo ‘I ran’”) }

end

It’s buggy as hell, but with a bit of cleaning is essentially all I  
would need for my purposes.
