在Mac上为jenkins,未正确设置PATH,否/usr/local/bin [英] jenkins on Mac, PATH is not set right, no /usr/local/bin

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

问题描述

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

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

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

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.

因此,在工作上,我告诉詹金斯运行Shell脚本echo $PATH.当然,路径/usr/local/bin不存在.如果我从Terminal执行相同的命令,它就会在那里.

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启动的.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,未正确设置PATH,否/usr/local/bin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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