-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
環境
macOS + zsh
問題発生時の状況
以下のエラーメッセージが出る
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
原因
- zshはコマンドパスをキャッシュしている
- macOSは /usr/bin/rails にデフォルトでrailsをインストールしている
- gem i rails する前にrailsコマンドを実行すると、(rbenvのrailsではなく) /usr/bin/rails を実行し、パスをキャッシュしてしまう
- そのあとでrbenv のRubyでgem i railsしても、キャッシュで覚えた /usr/bin/rails を実行してしまう
解決方法
rbenv rehashのほかに、zshのrehashコマンドを実行する
- $ rbenv rehash
- $ rehash
注意点
- しばらくはzshをインストールしている人はほぼいないと思うので問題はなさそう
- macOS Catalina からzshがデフォルトshellになるので、問題が起きるかもしれない
Reactions are currently unavailable