首先说明不建议使用官网 dmg 形式的安装包,搭建环境什么的强烈建议使用**命令行**。
1. 安装 brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. 升级 java
brew cask install java
3. 安装 jenkins
brew install jenkins
4. 执行
java -jar /usr/local/Cellar/jenkins/2.49/libexec/jenkins.war --httpPort=8080
5. 启动 jinkens
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
6. 停止 jinkens
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
若提示org.jenkins-ci.plist 文件未找到手动创建即可
sudo touch /Library/LaunchDaemons/org.jenkins-ci.plist
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>Jenkins</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/java</string>
<string>-jar</string>
<string>/usr/local/Cellar/jenkins/2.49/libexec/jenkins.war</string>
</array>
<key>OnDemand</key>
<false/>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>admin</string>
</dict>
</plist>