What is Homebrew?
Homebrew helps you easily install and uninstall programs to your computer (a package manager).
Examples: gcc, postgresql, heroku, gnuplot, redis, rbenv, python3, memcached, octave, git
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Installing an application (formula) with Homebrew
brew install <programName>
brew install octave
Update applications with Homebrew
What is RVM?
It allows you to manage the your ruby environment for each project. This usually means which ruby of version you’re using.
This is useful because you might have an old project that you built with ruby 2.2.1 and they made a change in 2.2.2 that breaks your app and you don’t have the time or can’t fix the problem.
Rbenv is another ruby version manager.
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable
Looking at the versions of Ruby available
rvm list known
Installing a version of Ruby
rvm install <versionName>
rvm install 2.3.1
Changing the version of Ruby you’re using
rvm use <versionName>
rvm use 2.3.1
Changing the default version of Ruby
rvm use 2.3.1 --default
What is RubyGems?
It’s a package manager for ruby, a programming language. It helps to install, update and uninstall programs that run with ruby which other people have build and you might want to use. RubyGems is called an application level package manager because it’s focused only those programs that run with ruby.
More application level package managers:
- cocoapods and carthage for iOS development using objective-c and swift
- npm for node
- pip for python
Examples of gems: nokogiri, rspec, bundler, rails, rake
It comes with ruby. If gem -v doesn’t provide a number, then download it here.
Installing a gem
gem install <gemName>
gem install bundler
gem update --system
What is Bundle?
Bundle manages the gems that you need for each project. Bundle is itself a gem. Instead of having to gem install <gemName>, you can add the list of gems you need and it will gem install of them for you.
If you already have the gem, then it doesn’t need to install it again, but it also knows the dependencies for gems you might want to use and will install those for you automatically.
RVM also has “gemsets” which is very similar.
In your project, you should have a Gemfile in the root directory.
It looks like this:
source 'https://rubygems.org' gem '<gemName>' gem '<gemName2>'
Install all the gems in the gemfile
Update the version of the gems