Ruby Gem Install Throw: You don't have write permissions

Critical Gems Takeover Bug Reported in RubyGems Package Manager

Hi there, another quick notes for my self and you (I know you are here because get same issue or just curious with this quick notes).

I get the error when I ran command gem install on fresh mac machine, that why I don't have my weapon kit (I named it weapon kit, hence I install so many languanges on main machine with version manager to handle different environment, like nvm, rvm, gvm, fvm and etc.)

 ❯ gem install colorize
Fetching colorize-1.1.0.gem
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

Just add .gem to your bash/zsh
export GEM_HOME="$HOME/.gem"
Because I used zsh terminal, then I will put that code on the last line on ~/.zshrc and don't forget to reload your terminal or just run command
source ~/.zshrc
Now your mac can run gem install command, without throw that error to your screen.

Komentar