LoginSignup
0
1

More than 5 years have passed since last update.

ruby versionがMac全体に適用されない時の対処方

Last updated at Posted at 2017-06-29

起こったこと

MacBook-Air-7:Users sato$ rbenv versions
  system
  2.2.2
  2.2.3
* 2.3.1 (set by /Users/sato/.rbenv/version)

こうなってるのにruby -vすると

ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]

あら。変わってない。

対処方

バージョンの切り替えが上手くいかなかった原因
~/.bash_profileに以下を追記する必要があった。

eval "$(rbenv init -)"

これをしないと、rbenvでインストールしたrubyのPATHが反映されない。

$ vi ~/.bash_profile # eval "$(rbenv init -)"を追記
$ source ~/.bash_profile # .bash_profileを読み込み、追記した設定を反映
# 改めてバージョンを確認
$ ruby -v
ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-darwin14]

参考

こちら

0
1
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
1