You can try install a Ruby Manager with Homebrew. I prefer to use rbenv. There are other options, notably rvm. Choose one and stick to it.
If you choose to use rbenv
brew install ruby-build rbenv
Follow the brew caveats in your terminal to add any needed environmental variables.
To list available versions
rbenv install --list
Install the one you like
rbenv install <version number>
As mentioned in a comment you may run into more issues down the line so if possible upgrade macOS version.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…