Ruby

  • macOS comes with Ruby installed but we are going to use the Homebrew version just like Git.
  • As it is much easier to manage and install different Ruby versions using rbenv.

rbenv - Simple Ruby version management

  • Type the followings in Terminal:

    brew install rbenv
    

    Install a particular Ruby version

  • Type the followings in Terminal:

    rbenv install 2.3.3
    rbenv rehash
    rbenv global 2.3.3
    

    In order to install a different Ruby version, replace the version number above.

bundler - dependency manager for Ruby

  • Before install any gems, type this in Terminal:
    eval "$(rbenv init -)"
    
  • Note: You don’t need to run the above command next time as it should be included in your ~/.bashrc or ~/.zshrc
  • I will cover this in Environment Config File section in this book

  • Type this in Terminal:

    gem install bundler
    

Ruby Gems

These are the gems I use during Ruby / iOS development. Feel free to adjust that suit your coding taste.

The following gems are going to be installed:

  1. rails - Ruby on Rails
  2. jekyll - Static site generator in Ruby
  3. compass - Sass-based Stylesheet Framework
  4. cocoapods - Dependency manager for Swift and Objective-C Cocoa projects

Install multiple Ruby Gems at once

gem install rails jekyll compass cocoapods

Troubleshooting

If you encounter this error while installing CocoaPods:

ERROR:  While executing gem ... (Gem::UnsatisfiableDependencyError)
    Unable to resolve dependency: 'cocoapods (= 0.36.1)' requires 'xcodeproj (~> 0.23.1)'

Try to install xcodeproj before CocoaPods:

gem install xcodeproj
gem install cocoapods

results matching ""

    No results matching ""