# Q: HOWTO: install a gem using rake?

**URL:** <https://www.ruby-forum.com/t/q-howto-install-a-gem-using-rake/155869>\
**Category:** Ruby\
**Created:** [December 17, 2008, 8:11pm UTC](https://www.ruby-forum.com/t/q-howto-install-a-gem-using-rake/155869 "2008-12-17T20:11:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremyheiler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/34f0e0/32.png) [@jeremyheiler](https://www.ruby-forum.com/u/jeremyheiler)\
**Post date:** [December 17, 2008, 8:11pm UTC](https://www.ruby-forum.com/t/q-howto-install-a-gem-using-rake/155869/1 "2008-12-17T20:11:34Z")

</div>

Is there a standard way to write a gem install task if you build it  
with GemPackageTask? AFAICT GemPackageTask doesn’t supply one which  
surprises me a little. I use ‘sh “gem install …”’ and I’m worried  
about how portable it is.

(BTW, would this be an appropriate question for the rake-devel list?  
If so then I’ll sign up.)

Thanks,

Jeremy H.

---

<div class="post-metadata">

**Author:** ![jeremyheiler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/34f0e0/32.png) [@jeremyheiler](https://www.ruby-forum.com/u/jeremyheiler)\
**Post date:** [December 18, 2008, 1:16pm UTC](https://www.ruby-forum.com/t/q-howto-install-a-gem-using-rake/155869/2 "2008-12-18T13:16:21Z")

</div>

On 2008-12-17, Aldric G. \<“aldric[remove]”@trevoke.net\> wrote:

> Jeremy H. wrote:
> 
> > I use ‘sh “gem install …”’ and I’m worried about how portable it  
> > is.
> 
> Surrounding a command with backticks sends it out to the OS.  
> e.g. `ping localhost`

Sorry, I didn’t make it clear that this “sh” is a Rake method that  
does (I imagine) pretty much the same thing as backticks. The  
Rakefiles of other gems often use more complicated constructions  
involving Gem::RUBY etc. and I wonder if this is to make things more  
portable. Sadly I can’t Google up anything that says “the right way  
to do it is … and here’s why”. It seems that most people bake  
their own solution without giving their reasons. Unless I’m missing  
something, of course.

Regards,

Jeremy H.
