提醒:强烈建议使用命令行进行安装,使用安装包dmg安装会有很多权限问题无法解决
PS:很久以前安装的,对JDK的要求忘记了,应该是需要JDK1.8,如果配置不成功,可以尝试配置JDK1.8后再尝试
step1:安装homebrew(已安装的跳过此步骤)
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
step2:安装Jenkins
brew install jenkins
step3:链接launchd配置文件
ln -sfv /usr/local/opt/jenkins/*.plist ~/Library/LaunchAgents
step4:开启和关闭jerkins服务。两种方法:
1、启动jenkins:launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
关闭Jenkins:launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
2、启动:brew services start jenkins
关闭:brew services stop jenkins
重启:brew services restart jenkins
step5:访问Jenkins
浏览器输入:http://localhost:8080,之后的流程和Windows一致,参考我的另一篇:https://blog.csdn.net/MDMsusu/article/details/106782580
踩坑:
1、brew安装jenkins会避免很多其他安装方式产生的用户权限问题,但会将httpListenAddress默认设置为127.0.0.1,这样我们虽然可以在本地用localhost:8080访问,但是本机和局域网均无法用ip访问。
解决办法为修改两个路径下的plist文件中的httpListenAddress后的ip地址,修改为本机IP或者0.0.0.0即可,然后重启:
~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
/usr/local/opt/jenkins/homebrew.mxcl.jenkins.plist