I am trying to install bundler and Jekyll on macOS and keep getting this error (below). I have tried using chruby and ruby-install (You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user)) but still, the problem is not solved. Any hits?
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.
/Library/Ruby/Site/2.6.0/rubygems/installer.rb:712:in `verify_gem_home'
/Library/Ruby/Site/2.6.0/rubygems/installer.rb:902:in `pre_install_checks'
/Library/Ruby/Site/2.6.0/rubygems/installer.rb:302:in `install'
/Library/Ruby/Site/2.6.0/rubygems/resolver/specification.rb:104:in `install'
/Library/Ruby/Site/2.6.0/rubygems/request_set.rb:194:in `block in install'
/Library/Ruby/Site/2.6.0/rubygems/request_set.rb:182:in `each'
/Library/Ruby/Site/2.6.0/rubygems/request_set.rb:182:in `install'
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:214:in `install_gem'
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:230:in `block in install_gems'
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:223:in `each'
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:223:in `install_gems'
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:169:in `execute'
/Library/Ruby/Site/2.6.0/rubygems/command.rb:327:in `invoke_with_build_args'
/Library/Ruby/Site/2.6.0/rubygems/command_manager.rb:252:in `invoke_command'
/Library/Ruby/Site/2.6.0/rubygems/command_manager.rb:192:in `process_args'
/Library/Ruby/Site/2.6.0/rubygems/command_manager.rb:150:in `run'
/Library/Ruby/Site/2.6.0/rub
I discovered the problem is due to my mac system permission requirements, so I tried to install jekyll and bundler using chruby and rbenv and ruby-install as detailed in the stackoverflow (https://stackoverflow.com/questions/51126403/you-dont-have-write-permissions-for-the-library-ruby-gems-2-3-0-directory-ma) but still I get the same error.
I also tried rbenv global 3.2.2 but still I was not able to solve the problem.
I would appreciate your insights.