Question

I did sudo gem install sass, which succeeded. Running sudo sass -v works fine, but running as a normal user gives:

$ sass -v
-bash: /usr/bin/sass: Permission denied

Indeed the executable's permissions are 700. I changed the permissions to 755, but that leads to:

$ sass -v
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'sass' (>= 0) among 4 total gem(s) (Gem::LoadError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
    from /usr/bin/sass:22:in `<main>'

I've google'd for everything but can't find a solution to this. Here's the output of gem env, which is identical if I do sudo gem env.

$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.0.3
  - RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [universal.x86_64-darwin13]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-13
  - GEM PATHS:
     - /Library/Ruby/Gems/2.0.0
     - /Users/ashish/.gem/ruby/2.0.0
     - /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/

I had to use sudo to install. Otherwise, I get:

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

No correct solution

OTHER TIPS

It worked for me: - First I´ve installed Homewbrew with:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

(DO NOT use sudo for this step!!)

  • verify the install with :

    brew -v

  • verify your Ruby install with :

    ruby -v

  • install sass with

    gem install sass

  • verify gem with:

    sass --version

and finally do:

rvm list known

Now I have: laomusics-mbp% ruby -v ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin10.0] in a OSX 1068, MBP.

Hope this helps others !

Had the same problem and also kept looking around for a long time. Eventually I had to uninstall Ruby and re-install it, only this time I did so with Homebrew, which is a package manager for Mac that gets it right.

Steps:

Now it should all be fine. Test it by installing a gem, for example sudo gem install sass, and once done, checking whether it's working with sass --version

Hope this helped you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top