# Problem with installing gems via rubygems

**URL:** <https://www.ruby-forum.com/t/problem-with-installing-gems-via-rubygems/196564>\
**Category:** Ruby\
**Created:** [January 8, 2008, 12:05pm UTC](https://www.ruby-forum.com/t/problem-with-installing-gems-via-rubygems/196564 "2008-01-08T12:05:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dizz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f6c823/32.png) [@dizz](https://www.ruby-forum.com/u/dizz)\
**Post date:** [January 8, 2008, 12:05pm UTC](https://www.ruby-forum.com/t/problem-with-installing-gems-via-rubygems/196564/1 "2008-01-08T12:05:44Z")

</div>

Hey I am having a problem installing rails on my ubuntu machine. I  
cannot install any gems and keep on getting the following error.

ERROR: Error installing rails:  
invalid gem format for /usr/lib/ruby/gems/1.8/cache/  
activerecord-2.0.2.gem

I have tried updating rubygems, manually installing rubygems (not  
using synaptic) and still cannot get ruby gems to work.

It would be great if anybody could give me a hand.

Thanks

---

<div class="post-metadata">

**Author:** ![dizz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f6c823/32.png) [@dizz](https://www.ruby-forum.com/u/dizz)\
**Post date:** [January 12, 2008, 11:27am UTC](https://www.ruby-forum.com/t/problem-with-installing-gems-via-rubygems/196564/2 "2008-01-12T11:27:29Z")

</div>

On Jan 8, 2008, at 03:04 AM, dizz wrote:

> It would be great if anybody could give me a hand.  
> Try deleting that file.

---

<div class="post-metadata">

**Author:** ![dizz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f6c823/32.png) [@dizz](https://www.ruby-forum.com/u/dizz)\
**Post date:** [January 12, 2008, 3:21pm UTC](https://www.ruby-forum.com/t/problem-with-installing-gems-via-rubygems/196564/3 "2008-01-12T15:21:05Z")

</div>

On Jan 12, 2008 6:29 AM, Romulo C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> dizz wrote:
> 
> > Hey I am having a problem installing rails on my ubuntu machine.

> And whenever you have an issue with gem, trying updating it first: `gem update --system`. That usually solves many problems.
> 
> Regards,  
> Romulo A. Ceccon

Only do gem update --system if you didn’t install rubygems via the  
.deb package. If you installed it with a .deb package (eg. with  
syntaptic), doing so will break rubygems.

Daniel Brumbaugh K.

---

<div class="post-metadata">

**Author:** ![dizz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f6c823/32.png) [@dizz](https://www.ruby-forum.com/u/dizz)\
**Post date:** [January 12, 2008, 1:29pm UTC](https://www.ruby-forum.com/t/problem-with-installing-gems-via-rubygems/196564/4 "2008-01-12T13:29:07Z")

</div>

Hi.

dizz wrote:

> Hey I am having a problem installing rails on my ubuntu machine. I  
> cannot install any gems and keep on getting the following error.
> 
> ERROR: Error installing rails:  
> invalid gem format for /usr/lib/ruby/gems/1.8/cache/  
> activerecord-2.0.2.gem
> 
> I have tried updating rubygems, manually installing rubygems (not  
> using synaptic) and still cannot get ruby gems to work.
> 
> It would be great if anybody could give me a hand.

Since one of the latest Rails versions I have had the same problem on my  
Windows box (actually that happens only when trying to install a second  
rails version on the same machine). I do the following to workaround it:

1. Manually download the Rails gem at  
[https://rubyforge.org/frs/?group\_id=307](https://rubyforge.org/frs/?group_id=307)
2. Unpack it with `gem unpack rails-X.X.X.gem`
3. Search the Rakefile file inside the unpacked dir for lines that start  
with s.add\_dependency
4. Manually download all the dependencies at rubyforge (each one has its  
own project)
5. Install each one with `gem install xxx.gem`. For Rails 2.0.1 the  
appropriate order is: activesupport, actionpack, actionmailer,  
activerecord, actionresource, rake, rails.

And whenever you have an issue with gem, trying updating it first: `gem update --system`. That usually solves many problems.

Regards,  
Romulo A. Ceccon
