"You don't have write permissions for the /usr/bin directory." when installing Sass using the Gem command

MacosTerminalSassRubygems

Macos Problem Overview


I'm on Mac and I'm trying to install Sass using the command in terminal, "sudo gem install sass". I then enter my password, and everything works fine until this pops up,

"ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /usr/bin directory."

I do use sudo, but it still doesn't work, and it's one of those things that you can't give yourself read & write permissions to. Any ideas?

Thanks,

Wade

Macos Solutions


Solution 1 - Macos

/usr/bin is protected by system integrity protection and is not writeable by anybody even root. You need to run:

sudo gem install -n /usr/local/bin sass

to install into a writeable directory

Solution 2 - Macos

For generamba:

sudo gem install -n /usr/local/bin generamba

Solution 3 - Macos

I used the same for bundler.

sudo gem install -n /usr/local/bin bundler.

It works.

Solution 4 - Macos

For CocoaPods:

sudo gem install -n /usr/local/bin cocoapods

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionWade M.View Question on Stackoverflow
Solution 1 - MacosAlan BirtlesView Answer on Stackoverflow
Solution 2 - MacosMihail SalariView Answer on Stackoverflow
Solution 3 - MacosAmitView Answer on Stackoverflow
Solution 4 - MacosAmericana AmericanView Answer on Stackoverflow