LoginSignup
0
0

More than 1 year has passed since last update.

rbenvでRubyのバージョン管理

Posted at

環境

  • macOS Monterey 12.1
  • Homebrew 3.6.12

rbenv

rbenvを使用してRubyのバージョン管理をする。

rbenvの準備

Homebrewをアップデートして、rbenvのインストール

$ brew update
$ brew install rbenv
$ rbenv -v
rbenv 1.2.0

デフォルトのRubyのバージョン参照先がrbenvの参照先に変えるためPATHの追記。
また、PC起動時にrbenvが自動で使用できるようにするための設定も記述。

$ vi ~/.zshrc

eval "$(rbenv init -)"
PATH="$HOME/.rbenv/bin:$PATH"

$ source ~/.zshrc

Rubyのインストール

インストール可能なRubyのバージョンを確認

// 下記どちらでもOK
$ rbenv install --list
$ rbenv install -l

上記コマンドの応答末尾にも記載があると思いますが、一応過去のイントール可能バージョンも見れます。

$ rbenv instlal --list-all

インストールしたいバージョンを指定してインストール

$ rbenv install 0.0.0

$ rbenv versions
* ststem
  0.0.0

バージョンの変更

$ rbenv global 0.0.0

$ rbenv versions
  system
* 0.0.0

$ ruby -v
ruby 0.0.0

参照

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0