“brew install ruby @2.3”+“gem install bundler”=>为什么找不到捆绑命令?

问题描述 投票:0回答:1
$ brew install [email protected]
...
$ echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
$ zsh
$ ruby --version
ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-darwin17]
$ gem install bundler
Successfully installed bundler-1.16.4
Parsing documentation for bundler-1.16.4
Done installing documentation for bundler after 4 seconds
1 gem installed
$ bundle
zsh: command not found: bundle

问题:为什么找不到bundle命令?

使用$ gem content bundler我找到了bundle可执行文件:

$ /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.4/exe/bundle --version

Bundler版本1.16.4

为什么bundle可执行文件不在/usr/local/opt/[email protected]/bin

我看到Bundle command not found mac问题,我必须使用rbenv?我不能只使用brew install [email protected]

更多信息:

$ brew --version
Homebrew 1.7.2-112-g0dc2c72
Homebrew/homebrew-core (git revision bc34; last commit 2018-09-02)

而且:

$ brew info [email protected]
[email protected]: stable 2.3.7 (bottled) [keg-only]
Powerful, clean, object-oriented scripting language
https://www.ruby-lang.org/
/usr/local/Cellar/[email protected]/2.3.7 (15,093 files, 38.3MB)
  Poured from bottle on 2018-09-02 at 19:44:13
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/[email protected]
==> Dependencies
Build: pkg-config ✔
Required: libyaml ✔, openssl ✔, readline ✔
==> Caveats
By default, binaries installed by gem will be placed into:
  /usr/local/lib/ruby/gems/2.3.0/bin

You may want to add this to your PATH.

[email protected] is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have [email protected] first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"

For pkg-config to find [email protected] you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"
ruby macos bundler
1个回答
2
投票

我建议使用rvmrbenv。否则你最终会得到多颗红宝石,而不会对它们及其不同的背景有任何控制。

这将非常混乱。你刚刚开始这个烂摊子!

© www.soinside.com 2019 - 2024. All rights reserved.