gpt4 book ai didi

macos - 安装程序如何在 Mac OSX 上设置 PATH 变量?

转载 作者:IT王子 更新时间:2023-10-29 01:33:42 26 4
gpt4 key购买 nike

我想知道 Mac 安装程序如何在 Mac OSX 上设置 PATH 变量。

例如:

查看 golang Mac OSX 安装程序。来自链接https://golang.org/doc/install :

Mac OS X package installer

Download the package file, open it, and follow the prompts to install the Go tools. The package installs the Go distribution to /usr/local/go.

The package should put the /usr/local/go/bin directory in your PATH environment variable. You may need to restart any open Terminal sessions for the change to take effect.

所以,我可以在 $PATH 中看到/usr/local/go/bin,但它没有在 .profile、.bashrc 或 launchd.conf 中设置。

谁能帮我理解一下?

最佳答案

在 Mac OS X ( lots of discussion here ) 中有几种设置环境变量的方法。在 Go 包的情况下,它在 /etc/paths.d 中添加一个名为 go 的文件,其中包含 /usr/local/go/bin。这是另一个问题的答案 explaining that a utility called path_helper is being launched它正在检查 /etc/paths.d 目录。

您可以使用名为 Pacifist 的应用程序自行验证这一点检查 Go 包的内容并查看它正在安装的文件。

关于macos - 安装程序如何在 Mac OSX 上设置 PATH 变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28446258/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com