3

So I'm switching to a project that is using ruby. They use asdf as a package manager

I’m having trouble installing the gems, I’m using zsh and I’m thinking there might be an issue with the paths

Running gem install bundler outputs: You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

ruby -v outputs: ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]

which ruby output: /usr/bin/ruby

And I tried setting a global version for ruby with asdf global ruby 2.5.3 but that doesn’t seem to change the version

This is my gem environment:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.2.3
  - RUBY VERSION: 2.3.7 (2018-03-28 patchlevel 456) [universal.x86_64-darwin18]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.3.0
  - USER INSTALLATION DIRECTORY: /Users/carlos.grijalva/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /Users/carlos.grijalva/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-18
  - GEM PATHS:
     - /Library/Ruby/Gems/2.3.0
     - /Users/carlos.grijalva/.gem/ruby/2.3.0
     - /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/carlos.grijalva/.asdf/shims
     - /Users/carlos.grijalva/.asdf/bin
     - /Users/carlos.grijalva/bin
     - /usr/local/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
4

1 回答 1

5

听起来您可能需要将相关行添加到您的.zshrcasdf 垫片中才能被识别。您可以在此处找到说明

对于 macOS 和 zsh,附加到 .zshrc 的正确行是:

echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zshrc
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc

这样做后,要么source ~/.zshrc或重新启动您的终端

于 2019-05-28T17:39:59.800 回答