Skip to content

Instantly share code, notes, and snippets.

@taogawa
Last active January 16, 2020 04:51
Show Gist options
  • Save taogawa/d493861acfc1e6c9ad3b to your computer and use it in GitHub Desktop.
Save taogawa/d493861acfc1e6c9ad3b to your computer and use it in GitHub Desktop.
Rubyのインストール

最終更新日

2020-1-16

前提環境

macOS Mojave(10.14.6)

手順

rbenvのインストール

Homebrewでインストールする。ruby-buildも一緒にインストールされる。

$ brew update
$ brew install rbenv

環境変数の追加

PATHに以下を追加

~/.rbenv/shims
~/.rbenv/bin
export CC=/usr/bin/gcc
eval "$(rbenv init -)"

ruby処理系のインストール

$ brew link readline --force
$ RUBY_CONFIGURE_OPTS=--with-readline-dir="$(brew --prefix readline) --with-openssl-dir=$(brew --prefix openssl@1.1)" CONFIGURE_OPTS="--disable-install-doc --disable-install-rdoc --disable-install-capi" rbenv install <version>
$ rbenv rehash

gemのアップデート

$ gem update --system --no-document
$ gem update --no-document
$ gem install bundler

その他

ruby のバージョン一覧を更新したい場合は ruby-build で更新する

$ brew upgrade ruby-build

インストール可能なバージョン一覧の確認

$ rbenv install -l
Available versions:
  1.8.5-p113
  1.8.5-p114
  1.8.5-p115
  1.8.5-p231
  1.8.5-p52
  1.8.6-p110
  (...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment