ERROR: Error installing rails:
There are no versions of activesupport (= 7.0.3) compatible with your Ruby & RubyGems. Maybe try installing an older version of the gem you're looking for?
activesupport requires Ruby version >= 2.7.0. The current ruby version is 2.6.3.62.
上記のエラーが出たので解消した手順を記す
Describe the procedure for resolving the above error
brewのアップデート
Update brew
brew update
rbenvをインストール
Install rbenv
brew install rbenv
rbenv initを実行
Run rbenv init
rbenv init
出てきた文章を読み、eval "$(rbenv init - zsh)"
の部分を~/.zshrcに追記
Read the text that comes up and add the eval "$(rbenv init - zsh)"
to ~/.zshrc
# Load rbenv automatically by appending
# the following to ~/.zshrc:
eval "$(rbenv init - zsh)"
~/.zshrcの再読み込み
Reload ~/.zshrc
source ~/.zshrc
rbenvで2.7系のrubyをインストール
Install ruby 2.7 series with rbenv
rbenv install 2.7.6
rbenv2.7.6を実際に使うように設定
Configure rbenv2.7.6 to actually use
rbenv local 2.7.6
rubyのバージョン確認
Check ruby version
ruby -v
これで2.7.6になってたらおk!
If it's 2.7.6, you're good to go!