This will fix the issue on MacOs MojaveMacOS Mojave and MacOs CatalinaCatalina in a clean way:
brew install ruby
brew install ruby
Then set GEM_HOMEGEM_HOME to your user directory. On the terminal:
Bash:
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME=$HOME/gems' >> ~/.bashrc
echo 'export PATH=$HOME/gems/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
OR if on Zsh:
echo '# Install Ruby Gems to ~/gems' >> ~/.zshrc
echo 'export GEM_HOME=$HOME/gems' >> ~/.zshrc
echo 'export PATH=$HOME/gems/bin:$PATH' >> ~/.zshrc
source ~/.zshrc
Bash:echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc echo 'export GEM_HOME=$HOME/gems' >> ~/.bashrc echo 'export PATH=$HOME/gems/bin:$PATH' >> ~/.bashrc source ~/.bashrcOR if on
Zsh:echo '# Install Ruby Gems to ~/gems' >> ~/.zshrc echo 'export GEM_HOME=$HOME/gems' >> ~/.zshrc echo 'export PATH=$HOME/gems/bin:$PATH' >> ~/.zshrc source ~/.zshrc