- The equivalent of
npm
is a combination of 2 tools:gem
: This is shipped with ruby. It helps installing ruby packages (called gems). That what you would typically use to install a ruby tool globally similar tonpm install -g <pkg>
.bundler
: This is not shipped with ruby (install it withgem install bundler
). It is the defacto tool to manage gems within project. It is equivalent tonpm install
. Bundler will generate aGemfile
and theGemfile.lock
that must be put under source-control. These are respectively equivalent topackage.json
andpackage-lock.json
.
- The equivalent of
nvm
isrvm
. Use it to manage multiple version of ruby.
\curl -L https://get.rvm.io | bash -s stable --ruby
rvm list known
rvm install ruby-2.4.2
The first command helps to determine which exact version you need.
List all the currently installed ruby versions:
rvm list
Switch to a specific version:
rvm use 2.4.3
Set the default ruby version so next time you won't have to:
rvm --default use 2.4.3
rvm list known
gem install <lib>
gem list
gem update <lib>