使用 brew 安装 Jenkins
brew install Jenkins
启动 Jenkins
brew services start Jenkins
关闭 Jenkins
brew services stop Jenkins
重启 Jenkins
brew services restart Jenkins
使用brew 安装 Jenkins ,会解决一些权限等问题,但是默认配置 为 localhost:8080
需要修改端口,以避免配置冲突,文件路径:
where jenkins
使用 where 命令查询 Jenkins 路径,
/opt/homebrew/bin/jenkins
那么修改 /opt/homebrew/Cellar/jenkins/2.304/homebrew.mxcl.jenkins.plist
文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>homebrew.mxcl.jenkins</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/opt/openjdk@11/bin/java</string>
<string>-Dmail.smtp.starttls.enable=true</string>
<string>-jar</string>
<string>/opt/homebrew/opt/jenkins/libexec/jenkins.war</string>
<string>--httpListenAddress=0.0.0.0</string>
<string>--httpPort=8089</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
修改 端口 httpPort 为 8089,httpListenAddress 为 0.0.0.0 或者 本机 IP地址。
同时修改 Library/LaunchAgents/homebrew.mxcl.jenkins.plist 文件,重启 Jenkins 生效。