英文:
What's the difference between Homebrew's ruby and "Homebrew Ruby"?
问题
在我的brew --config
输出中,我有以下这行:
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
这让我感到困惑,因为这不是我使用brew install ruby
安装的Ruby,也不是系统默认提供的Ruby(在我的PATH中只有这两个)。
"Homebrew Ruby" 和通过"brew install ruby"安装的Ruby之间有什么区别?后者的gems存放在哪里?
英文:
In my brew --config
output I have the line
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
which confuses me because this is not the Ruby I've installed using
brew install ruby
nor the one that comes by default with my system (which are there only two on my PATH).
What's the difference between Homebrew-istalled ruby and "Homebrew Ruby"? Where are the gems for the latter?
答案1
得分: 3
可能 Ruby 的系统版本位于 /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby
,但如果你仔细检查路径的各个组件,你会发现 Current
实际上是一个符号链接:
这是我的系统上的情况(macOS Ventura 13.2):
$ ls -l /System/Library/Frameworks/Ruby.framework/Versions/
total 0
drwxr-xr-x 5 root wheel 160 Jan 14 02:57 2.6
lrwxr-xr-x 1 root wheel 3 Jan 14 02:57 Current -> 2.6
这与 brew --config
报告的版本相同。Homebrew 解析符号链接并显示 Ruby 可执行文件的真实路径。
使用 brew install ruby
安装的 Ruby 版本位于其他地方。使用 brew info ruby
查找它的安装位置。该位置取决于你的 Mac 计算机的硬件(在 Linux 上也不同)。
英文:
Most probably the system version of Ruby is located at /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby
but if you inspect closely the components of the path you will find out that Current
is, in fact, a symlink:
This is how it looks like on my system (macOS Ventura 13.2):
$ ls -l /System/Library/Frameworks/Ruby.framework/Versions/
total 0
drwxr-xr-x 5 root wheel 160 Jan 14 02:57 2.6
lrwxr-xr-x 1 root wheel 3 Jan 14 02:57 Current -> 2.6
It is the same version as the one reported by brew --config
. Homebrew resolves the symlink and displays the real path of the Ruby executable.
The version of Ruby installed using brew install ruby
is located somewhere else. Use brew info ruby
to find out where it is installed. The location depends on the hardware of your Mac computer (and it is also different on Linux).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论