douluogu8713
2015-02-11 03:44
浏览 80
已采纳

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

I'm wondering how PATH variable is set by Mac Installers on Mac OSX.

For example:

Look at golang Mac OSX Installer. From the link 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.

So, the I can see /usr/local/go/bin in $PATH but it's not being set in .profile, .bashrc or launchd.conf.

Can anybody please help me to understand?

图片转代码服务由CSDN问答提供 功能建议

我想知道Mac OSX上的Mac Installers如何设置PATH变量。

例如:

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

Mac OS X软件包安装程序

下载软件包文件,将其打开,然后按照提示安装Gon工具。 该软件包将Go发行版安装到 /usr/local/go。

该软件包应将/ usr / local / go / bin目录放在PATH 环境变量中。 您可能需要重新启动所有打开的Terminal 会话,以使更改生效。

因此,我可以在/ usr / local / go / bin中看到 $ PATH,但未在.profile,.bashrc或launchd.conf中设置。

有人可以帮助我理解吗?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongsuoying9059 2015-02-11 04:08
    已采纳

    There are a couple methods of setting environment variables in Mac OS X (lots of discussion here). In the case the Go package, it is adding a file in /etc/paths.d named go that contains /usr/local/go/bin. Here's an answer to another question explaining that a utility called path_helper is being launched and it's inspecting the /etc/paths.d directory.

    You can verify this yourself by using an application called Pacifist to inspect the contents of the Go package and looking at the files it's installing.

    点赞 打赏 评论

相关推荐 更多相似问题