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

42,861

Solution 1

/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

For generamba:

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

Solution 3

I used the same for bundler.

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

It works.

Solution 4

For CocoaPods:

sudo gem install -n /usr/local/bin cocoapods
Share:
42,861
Admin
Author by

Admin

Updated on April 28, 2021

Comments

  • Admin
    Admin about 3 years

    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

  • Dimitri
    Dimitri almost 6 years
    I'm not sure this is the best solution. What if you want to install it system wide?
  • Alan Birtles
    Alan Birtles almost 6 years
    @Dimitri /usr/local is system wide, it's where you are supposed to install software on mac os, there is no way to write to /usr/bin without disabling sip
  • Aboozar Rajabi
    Aboozar Rajabi over 5 years
    @AlanBirtles I installed it using your command but Rails thinks the gem is missing. How to say it the gem is installed somewhere else?
  • Alan Birtles
    Alan Birtles over 5 years
    You could try setting the GEM_PATH environment variable
  • trapper
    trapper over 4 years
    Why does it use /usr/bin by default if it will never work?
  • Alan Birtles
    Alan Birtles over 4 years
    @trapper presumably its just installing to the same place as ruby itself is installed
  • IgorGanapolsky
    IgorGanapolsky over 3 years
    What is generamba?
  • Mihail Salari
    Mihail Salari over 3 years
    @IgorGanapolsky, it's a code generator tool: github.com/strongself/Generamba