# Problem with gem

**URL:** <https://www.ruby-forum.com/t/problem-with-gem/50784>\
**Category:** Ruby\
**Created:** [December 21, 2005, 4:56am UTC](https://www.ruby-forum.com/t/problem-with-gem/50784 "2005-12-21T04:56:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohammad\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8e8cbc/32.png) [@Mohammad\_K](https://www.ruby-forum.com/u/Mohammad_K)\
**Post date:** [December 21, 2005, 4:56am UTC](https://www.ruby-forum.com/t/problem-with-gem/50784/1 "2005-12-21T04:56:07Z")

</div>

Hello,

I am trying to make a gem package for one of my library that I am  
going to make avaiable soon. Problem is, I can successfully install my  
gem on the machine where I build the gem. But if I copy that gem to  
another machine and try to install it I get

[root@ruby-agi download]# gem install ruby-agi-0.0.3.gem  
Attempting local installation of ‘ruby-agi-0.0.3.gem’  
ERROR: Error installing gem ruby-agi-0.0.3.gem[.gem]: parse error on  
line 0, col 31: `!ruby/object:Gem::Specification ’

on both build machine and client machine I have gem-0.8.11  
I also gave a try by deleting source\_cache file, but no luck.

I am sure, I havn’t provide enough information to identify the  
problem. What else I should provide, please suggest. I am new at gem  
packaging. Your help would be greatly appreciated.

Thanks,  
Mohammad K.

---

<div class="post-metadata">

**Author:** ![Mohammad\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8e8cbc/32.png) [@Mohammad\_K](https://www.ruby-forum.com/u/Mohammad_K)\
**Post date:** [December 21, 2005, 1:01pm UTC](https://www.ruby-forum.com/t/problem-with-gem/50784/2 "2005-12-21T13:01:09Z")

</div>

Mohammad K. wrote:

> Hello,
> 
> I am trying to make a gem package for one of my library that I am  
> going to make avaiable soon. Problem is, I can successfully install my  
> gem on the machine where I build the gem. But if I copy that gem to  
> another machine and try to install it I get
> 
> [root@ruby-agi download]# gem install ruby-agi-0.0.3.gem  
> Attempting local installation of ‘ruby-agi-0.0.3.gem’  
> ERROR: Error installing gem ruby-agi-0.0.3.gem[.gem]: parse error on  
> line 0, col 31: `!ruby/object:Gem::Specification ’

Sounds like you built the gem on a Ruby 1.8.3 system and are trying to  
install it on a Ruby 1.8.2 system. Version 1.8.3 has a backwards  
compatibility bug in the Yaml code such that the yaml produced on 1.8.3  
cannot be read on earlier systems.

Fortunately, I’ve heard rumours that 1.8.4 (out real soon now) will  
correct that bug.

–  
– Jim W.

---

<div class="post-metadata">

**Author:** ![Mohammad\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8e8cbc/32.png) [@Mohammad\_K](https://www.ruby-forum.com/u/Mohammad_K)\
**Post date:** [December 21, 2005, 5:50pm UTC](https://www.ruby-forum.com/t/problem-with-gem/50784/3 "2005-12-21T17:50:16Z")

</div>

Hi Jim,

Thanks a lot for your reply.  
Yes, ruby version is the issue at my end.

I am going to add the following line in my spec file  
spec.required\_ruby\_version = ‘\>= 1.8.3’

Thanks again,  
Mohammad K.

---

<div class="post-metadata">

**Author:** ![Mohammad\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8e8cbc/32.png) [@Mohammad\_K](https://www.ruby-forum.com/u/Mohammad_K)\
**Post date:** [December 21, 2005, 6:29pm UTC](https://www.ruby-forum.com/t/problem-with-gem/50784/4 "2005-12-21T18:29:31Z")

</div>

On Wed, 21 Dec 2005 16:47:32 -0000, Mohammad K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I am going to add the following line in my spec file  
> spec.required\_ruby\_version = ‘\>= 1.8.3’

I think there shouldn’t be any need to do that just for the Yaml issue -  
if you upgrade to 1.8.4 in a few days, or even downgrade to 1.8.2, your  
gem will be fine.

If you _really_ don’t want to switch versions, you could use a  
workaround  
I use, that I believe works (it at least gets gems distributed by  
Rubyforge, and I’ve had no complaints about them not working on prior  
versions). See  
[http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/171295](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/171295) (yes,  
this time I _could_ find the thread :))
