Ruby Gem command and rubygem command

Source: Internet
Author: User

Ruby Gem command and rubygem command

I. Introduction

Gem is a standard package for managing Ruby libraries and programs. It is very convenient to find, install, upgrade, and uninstall software packages through Ruby Gem (such as http://rubygems.org/) sources. Ruby Gem is installed in Ruby 1.9.2 by default. If you are using another release version, install Ruby Gem on your own.

All the gem packages will be installed in the/[Ruby root]/lib/ruby/gems/[ver]/directory, this includes four directories: Cache, doc, gems, and specifications. Place the downloaded native gem package under the cache, and place the decompressed gem package under gems. When problems occur during installation, you can enter these directories, manually delete the problematic gem package, and then run the gem install [gemname] command again.

Ii. Installation

Two installation methods

Method 1: Install using yum

yum install rubygems

 

Method 2: source code Installation

Resource download: rubygems-2.4.6.tgz

https://rubygems.org/pages/download

Install

tar –zxvf rubygems-2.4.6.tgzcd rubygems-2.4.6ruby setup.rb

 

Iii. Instances

1) view all installed gem packages on the local machine

$ gem list [--local]

2) install the gem package from the Local Machine

$ gem install -l [gemname].gem

3) install the Gem package from the gem Source

$ gem install [gemname]

4) install the gem package of the specified version

$ gem install [gemname] --version=[ver]

5) Update the Gem itself (Note: In some linux distributions, this command is not allowed to be executed for system stability)

$ gem update --system

6) update all installed gem packages

$ gem update

7) update the specified gem package (Note: gem update [gemname] will not upgrade the earlier version of the package, you can use gem install [gemname] -- version = [ver] Instead)

$ gem update [gemname]

8) Delete the specified gem package. Note that this command will delete all installed versions.

$ gem uninstall [gemname]

9) delete a specified version of gem

$ gem uninstall [gemname] --version=[ver]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.