All notes


Quick Start

rubygems guides.

# Check source.
gem sources

# Rebuild index for affected sources, e.g.
gem generate_index

# -d: detail
gem search ^rails [-d]

gem install GEMNAME --source

gem list

# Read doc for installed GEMNAME:
# Read doc on http server:
gem server

# Fetch and read without installation. If you doubt about security of GEMNAME:
gem fetch $GEMNAME
gem unpack $GEMNAME

gem build GEMNAME.gemspec
gem install gemname-version.gem

# Specify that a gem should come from a git repository with a .gemspec at its root
# Because Rubygems lacks the ability to handle gems from git, any gems installed from a git repository will not show up in gem list.
# They will, however, be available after running Bundler.setup.
gem 'nokogiri', :git => ''

# What if
# /usr/bin/ruby extconf.rb 
# mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h
sudo yum -y install ruby-devel

# See environment.
gem env
# Notice the two sections for:

# gem sources should at least contain If not
gem sources -a

SO provides a brief introduction to: gems, RubyGems, bundler, rvm, gemsets.


Can't install passenger

Ref. Put passenger gem to Gemfile.


Newer gem installed but old ones are required

gem uninstall then install the old version again

Establish googleapis mirror

git clone
cd googleapis-mirror
sudo yum install rubygem-rake
gem install bundler
gem install io-console
bundle install

rake sync
# The following step could be replaced by Apache/Nginx.
# sudo rake serve

Then let Apache server these files as a mirror:

<VirtualHost *:80>
  DocumentRoot "/path/to/googleapis-mirror"
  <Directory "/path/to/googleapis-mirror">
    Options Indexes
    Require all granted

Then add in your hosts:


Mirrors for ruby gems

# If there is SSL certificate problem, change https to http:
gem sources --add --remove
gem sources -l

gem update --system
gem -v