ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]) showed me the error like this:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.RVM and rbenv. I decided to try with the second one, mainly due to its general simplicity.
Apart of the problem with ruby, I mainly work with JavaScript, so (Node Version Manager) is my best friend while working with frontend projects. When I have to deal with different versions of NodeJS and jump between them quickly, the same like , solves the problem with simple client interface and more importantly "it just works".
rbenvnvmrbenv with my shell (ZSH), I did:brew install rbenv
echo 'eval "$(rbenv init -)"' >> ~/.zshrcrbenv is there. Lovely!$ rbenv --version
rbenv 1.1.1
# checks if the installation has been done successfully
$ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
Checking for `rbenv' in PATH: /usr/local/bin/rbenv
Checking for rbenv shims in PATH: OK
Checking `rbenv install' support: /usr/local/bin/rbenv-install (ruby-build 20181019)
Counting installed Ruby versions: 1 versions
Checking RubyGems settings: OK
Auditing installed plugins: OK
$ rbenv install -v 2.5.1 # this might take while, so adding -v flag will give you visial feedback that it didn't stuck
...
$ rbenv global 2.5.1
$ gem update --system
$ gem install bundler # or other important gemsbundle install
Traceback (most recent call last):
1: from /usr/local/bin/bundle:23:in `<main>'
/usr/local/bin/bundle:23:in `load': cannot load such file -- /usr/local/lib/ruby/gems/2.5.1/gems/bundler-1.16.1/exe/bundle (LoadError)bundler seems not being installed. How? I already installed the bundler and checks if the installation was successful.PATH. Awesome, now installation of new ruby version and gems (even globally in the system) is a piece of cake!