Question

At work I am forced to use an old rubygem version. Upgrading is not possible due to IT department being lazy.

Is there a way to unpack a .gem file without gem unpack?

Thanks.

Was it helpful?

Solution

Gem files are just uncompressed tar archives. You can unpack them using the tar command:

$ ls
fruity-0.2.0.gem

$ tar xf fruity-0.2.0.gem 
$ ls
data.tar.gz  fruity-0.2.0.gem  metadata.gz

The file data.tar.gz is a gzip compressed tar archive that contains the gem files, you can unpack it using tar:

$ mkdir gem; cd gem
$ tar xzf ../data.tar.gz
$ ls
fruity.gemspec  Gemfile.lock  LICENSE.txt  README.rdoc  VERSION
Gemfile         lib           Rakefile     spec
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top