MacOS Catalina Rails 6.0.3.2 Ruby 2.7.1(2.6.3)
There was no problem until the day before, but when I started the PC the next day and "Rails s", The error "Your Ruby version is 2.6.3, but your Gemfile specified 2.7.1" occurred.
If you check the version of Ruby Ruby -v → 2.6.3 rbenv --version → 2.7.1
I set it to "rbenv global 2.7.1", but it doesn't switch ...
$ which ruby
/usr/local/bin
Since it refers to a location different from the location installed by rbenv, change the location.
$ vi ~/.bash_profile
The state of the file is as follows.
export PATH=/usr/local/bin:$PATH
export PATH="~/.rbenv/shims:/usr/local/bin:$PATH"
eval "$(rbenv init -)"
eval "$(rbenv init -)"
eval "$(rbenv init -)"
There is the same description that the first line seems to work, so modify it as follows.
export PATH="~/.rbenv/shims:/usr/local/bin:$PATH"
eval "$(rbenv init -)"
Use "dd" to delete one line of the used vi command, and ": wq" to save and exit.
$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
The Ruby version has switched successfully!
Recommended Posts