Take the 2-minute tour ×

I'd like to write a package for Ruby and make it available as a gem.
What are the tools, steps and pitfalls ?
Are there any good tutorials, screencasts, etc., which helped you learning how to do it ?

share|improve this question
add comment

5 Answers

up vote 170 down vote accepted

Rubygems.org's Guides is one of the best resources for writing your own gem.

If you're using Bundler in your app, you might want to look at Ryan Bigg's guide to Developing a RubyGem using Bundler and the Railscast on creating gems with Bundler.

If you're interested in tools to help you write gems:

Some tutorials/guides:

share|improve this answer
gem build is provided by RubyGems itself. All the Gemcutter gem (and soon, RubyGems proper) allows you to do is push a RubyGem using the API. gemcutter.org/pages/gem_docs gemcutter.org/pages/api_docs –  qrush Feb 9 '10 at 5:36
Thanks, I've edited the response. –  Jack Chu Feb 9 '10 at 13:09
add comment

I wrote a guide on writing a gem using Bundler which you may find useful.

share|improve this answer
Sweet ! Thanks. –  subtenante Dec 13 '10 at 9:24
And now there's a railscast too. railscasts.com/episodes/245-new-gem-with-bundler –  Mark Thomas Dec 20 '10 at 17:50
Awesome thing! Thanks! –  iafonov Aug 14 '11 at 17:48
This is excellent! Many thanks –  Alex Dean Jun 16 '12 at 15:55
add comment



Once you have something you want to share, put it on github and push it to gemcutter.

Don't over think it, don't use hoe or other overkill tools, have fun, don't to anything I wouldn't do.

share|improve this answer
add comment

This is how I usually create and release Gems:

  1. Sign-up for https://github.com
  2. Sign-up for https://rubygems.org
  3. $ gem install ore rubygems-tasks rdoc rspec
  4. $ mine awesome_gem
  5. cd awesome_gem/ and edit the README.rdoc and awesome_gem.gemspec, write code in lib/awesome_gem/ and adding RSpec tests in specs/.
  6. when you're ready to release, update the ChangeLog.rdoc file, run rake spec and rake rerdoc, open up html/index.html and double-check for any typos.
  7. rake release
  8. (Optional) submit a link and explanation of your new awesome gem to http://rubyflow.com

Sit back and bask in the glory of your first Gem. :)

share|improve this answer
add comment

Take a look at:

share|improve this answer
add comment

Your Answer


