Mac 上的 jenkins,路径设置不正确,没有/usr/local/bin [英] jenkins on Mac, PATH is not set right, no /usr/local/bin

查看:32
本文介绍了Mac 上的 jenkins,路径设置不正确,没有/usr/local/bin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近使用 Homebrew 安装了 Jenkins.我还使用 Homebrew 安装了 Mercurial.

I recently installed Jenkins, using Homebrew. I also installed Mercurial using Homebrew.

我可以从终端成功克隆一个 hg 存储库.但是,如果我尝试在 Jenkins 的工作中做同样的事情,它就会失败.

I can successfully clone an hg repo just fine - from Terminal. But if I try and do the same thing as part of a job in Jenkins, it fails.

所以,在工作中,我告诉 Jenkins 运行一个 shell 脚本 echo $PATH.果然,路径 /usr/local/bin 不存在.如果我从终端执行相同的命令,它就在那里.

So, in by job, I told Jenkins to run a shell script echo $PATH. Sure enough, the path /usr/local/bin is not there. If I execute the same command from Terminal, it's there.

那么,当我从终端回显它时,修改 PATH 以便 Jenkins 拉出我正在使用的相同 PATH 的最佳方法是什么?

请注意,Jenkins 是使用我登录进行这些测试时登录的同一用户帐户运行的,所以我无法理解为什么会发生这种情况.

Note, Jenkins is running from the same user account that I'm logged into doing these tests, so I can't fathom why this is happening.

推荐答案

在 Jenkins 的 launchd .plist 文件中,您可以使用以下命令设置 PATH 环境变量:

In your launchd .plist file for Jenkins, you can set the PATH environment variable by using the following:

<key>EnvironmentVariables</key>
<dict>
    <key>PATH</key>
    <string>(insert your path value here)</string>
</dict>

这应该将 PATH 设置为您需要的任何内容.

That should set the PATH to whatever you need.

这篇关于Mac 上的 jenkins,路径设置不正确,没有/usr/local/bin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆