# Avoid reinstalling gem (if its already installed?)

**URL:** <https://www.ruby-forum.com/t/avoid-reinstalling-gem-if-its-already-installed/144052>\
**Category:** Ruby\
**Created:** [July 24, 2008, 10:32pm UTC](https://www.ruby-forum.com/t/avoid-reinstalling-gem-if-its-already-installed/144052 "2008-07-24T22:32:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsanheim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/47e85d/32.png) [@rsanheim](https://www.ruby-forum.com/u/rsanheim)\
**Post date:** [July 24, 2008, 10:32pm UTC](https://www.ruby-forum.com/t/avoid-reinstalling-gem-if-its-already-installed/144052/1 "2008-07-24T22:32:28Z")

</div>

Is there a way to have rubygems not reinstall a gem if the latest  
version is already installed?

For example, I want the second ‘install’ below to simply say ‘already  
installed’ and exit successfully.

rsanheim@ares:~ $ sudo gem install bacon  
Successfully installed bacon-1.0.0  
1 gem installed  
Installing ri documentation for bacon-1.0.0…  
Installing RDoc documentation for bacon-1.0.0…

rsanheim@ares:~ $ sudo gem list|grep bacon  
bacon (1.0.0, 0.9.0)

rsanheim@ares:~ $ sudo gem install bacon  
Successfully installed bacon-1.0.0  
1 gem installed  
Installing ri documentation for bacon-1.0.0…  
Installing RDoc documentation for bacon-1.0.0…

thanks,

- Rob

---

<div class="post-metadata">

**Author:** ![rsanheim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/47e85d/32.png) [@rsanheim](https://www.ruby-forum.com/u/rsanheim)\
**Post date:** [July 25, 2008, 1:47am UTC](https://www.ruby-forum.com/t/avoid-reinstalling-gem-if-its-already-installed/144052/2 "2008-07-25T01:47:00Z")

</div>

On Jul 24, 2008, at 13:26 PM, Rob S. wrote:

> Is there a way to have rubygems not reinstall a gem if the latest  
> version is already installed?
> 
> For example, I want the second ‘install’ below to simply say ‘already  
> installed’ and exit successfully.

Why do you care?

---

<div class="post-metadata">

**Author:** ![rsanheim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/47e85d/32.png) [@rsanheim](https://www.ruby-forum.com/u/rsanheim)\
**Post date:** [July 25, 2008, 2:37am UTC](https://www.ruby-forum.com/t/avoid-reinstalling-gem-if-its-already-installed/144052/3 "2008-07-25T02:37:17Z")

</div>

On Thu, Jul 24, 2008 at 7:40 PM, Eric H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> On Jul 24, 2008, at 13:26 PM, Rob S. wrote:
> 
> > Is there a way to have rubygems not reinstall a gem if the latest  
> > version is already installed?
> > 
> > For example, I want the second ‘install’ below to simply say ‘already  
> > installed’ and exit successfully.
> 
> Why do you care?

I’m going to be setting up machines with stock set of gems, and then  
periodically refreshing them with a revised list. I’d like to have  
gem skip the ones it already has for efficiency.

So I take it I would have to use the gem api to do this?

- Rob

---

<div class="post-metadata">

**Author:** ![rsanheim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/47e85d/32.png) [@rsanheim](https://www.ruby-forum.com/u/rsanheim)\
**Post date:** [July 25, 2008, 3:29am UTC](https://www.ruby-forum.com/t/avoid-reinstalling-gem-if-its-already-installed/144052/4 "2008-07-25T03:29:46Z")

</div>

On Jul 24, 2008, at 17:30 , Rob S. wrote:

> for efficiency

If only I could wipe this series of words from people’s brains…

---

<div class="post-metadata">

**Author:** ![rsanheim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/47e85d/32.png) [@rsanheim](https://www.ruby-forum.com/u/rsanheim)\
**Post date:** [July 25, 2008, 5:22am UTC](https://www.ruby-forum.com/t/avoid-reinstalling-gem-if-its-already-installed/144052/5 "2008-07-25T05:22:07Z")

</div>

On Jul 24, 2008, at 17:30 PM, Rob S. wrote:

> > Why do you care?
> 
> I’m going to be setting up machines with stock set of gems, and then  
> periodically refreshing them with a revised list. I’d like to have  
> gem skip the ones it already has for efficiency.
> 
> So I take it I would have to use the gem api to do this?

No, your “stock set of gems” should be a gem that only has  
dependencies on other gems.

---

<div class="post-metadata">

**Author:** ![rsanheim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/47e85d/32.png) [@rsanheim](https://www.ruby-forum.com/u/rsanheim)\
**Post date:** [July 25, 2008, 5:27am UTC](https://www.ruby-forum.com/t/avoid-reinstalling-gem-if-its-already-installed/144052/6 "2008-07-25T05:27:58Z")

</div>

On Thu, Jul 24, 2008 at 8:41 PM, Ryan D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> If only I could wipe this series of words from people’s brains…

Seriously, like our users who have this crazy notion that web pages  
should take less than two minutes to load. If only we could use Jedi  
mind tricks on them…

It’s like they think programmers are actually supposed to make life  
easier for them, or something.

😉

–  
Avdi

Home: [http://avdi.org](http://avdi.org)  
Developer Blog: [Avdi Grimm, Code Cleric](http://avdi.org/devblog/)  
Twitter: [http://twitter.com/avdi](http://twitter.com/avdi)  
Journal: [http://avdi.livejournal.com](http://avdi.livejournal.com)
