如何在Mac上为所有用户安装SASS?

时间:2017-08-10 18:15:52

标签: ruby macos sass rubygems

我整天尝试在SASS页面上详细安装SASS,但我只能从我的管理员帐户运行它。

为了安全起见,在我的Mac上我有2个用户帐户,admin用户(我只使用它来安装和卸载软件)和普通用户,我将其用于其他所有用户。

当我从admin用户帐户运行命令sass -v时,我有sass版本但是,当我从普通用户帐户运行相同的命令时,我有下一个错误

env: ruby_executable_hooks: No such file or directory

我尝试从普通用户帐户安装sass,但它告诉我我没有权限。

NORMAL用户的RubyGems环境是:

    RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.12
  - RUBY VERSION: 2.0.0 (2015-12-16 patchlevel 648) [universal.x86_64-darwin16]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0
  - USER INSTALLATION DIRECTORY: /Users/mramos/.gem/ruby/2.0.0
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin
  - SPEC CACHE DIRECTORY: /Users/mramos/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-16
  - GEM PATHS:
     - /Library/Ruby/Gems/2.0.0
     - /Users/mramos/.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/
  - SHELL PATH:
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin
     - /Users/mramos/.rvm/bin

ADMINISTRATOR用户的RubyGems环境是:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.12
  - RUBY VERSION: 2.4.1 (2017-03-22 patchlevel 111) [x86_64-darwin16]
  - INSTALLATION DIRECTORY: /Users/admin/.rvm/gems/ruby-2.4.1
  - USER INSTALLATION DIRECTORY: /Users/admin/.gem/ruby/2.4.0
  - RUBY EXECUTABLE: /Users/admin/.rvm/rubies/ruby-2.4.1/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/admin/.rvm/gems/ruby-2.4.1/bin
  - SPEC CACHE DIRECTORY: /Users/admin/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/admin/.rvm/rubies/ruby-2.4.1/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-16
  - GEM PATHS:
     - /Users/admin/.rvm/gems/ruby-2.4.1
     - /Users/admin/.rvm/gems/ruby-2.4.1@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/admin/.rvm/gems/ruby-2.4.1/bin
     - /Users/admin/.rvm/gems/ruby-2.4.1@global/bin
     - /Users/admin/.rvm/rubies/ruby-2.4.1/bin
     - /usr/local/opt/openssl/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin
     - /Users/admin/.rvm/bin
     - /Users/admin/.rvm/bin

请帮忙!

1 个答案:

答案 0 :(得分:0)

完成!我在下面分享我的解决方案:

  1. 我已经卸载了我通过RVM获得的所有ruby版本。
  2. 然后卸载了rvm,就像在这篇帖子中显示的那样=> How can I remove RVM (Ruby Version Manager) from my system?
  3. 我已经重新安装了RVM,但是在多用户'模式,如官方RVM站点上所述,使用以下命令:\curl -sSL https://get.rvm.io | sudo bash -s stable

  4. 我已使用以下命令将用户逐个添加到组rvm中:

    sudo dseditgroup -o edit -a username_to_add -t user rvm

  5. 已退出并重新登录

  6. 使用以下命令通过gem安装SASS:rvm all do gem install sass

  7. 验证安装:sass -v

  8. 我希望这篇文章可以帮助别人!