Victor Leung
Victor Leung
BlogAI SolutionAlphaAlgoFlower shopFX CombineIEESushi ClassifierWealth Agile

Fix Ruby Gems Permission Error

June 28, 2015

The Problem

When install gem in Mac OS X Yosemite, I got the following error:

ERROR: While executing gem … (Gem::FilePermissionError) You don’t have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

The Solution

Step 1: Install Rbenv

brew install rbenv ruby-build

echo ‘export PATH=”$HOME/.rbenv/bin:$PATH”’ >> ~/.zshrc

echo ‘eval “$(rbenv init -)”’ >> ~/.zshrc

Note: Modify your ~/.bash_profile instead of ~/.zshrc file if you’re not using zsh.

Step 2: Close your terminal and restart the shell

Step 3: Install Ruby, Set globle and Rehash

rbenv install 2.0.0-p247

rbenv global 2.0.0-p247

rbenv rehash

Step 4: gem install as usual

Now you should get the gem successfully installed!


About Victor Leung

Software development professional with expertise in application architecture, cloud solutions deployment, and financial products development. Possess a Master's degree in Computer Science and an MBA in Finance. Highly skilled in AWS (Certified Solutions Architect, Developer and SysOps Administrator), GCP (Professional Cloud Architect), Microsoft Azure, Kubernetes(CKA, CKAD, CKS, KCNA), and Scrum(PSM, PSPO) methodologies.

Happy to connect
LinkedIn
Github
Twitter
@victorleungtw

Continuous improvement

Copyright © victorleungtw.com 2023.