1.安装HomeBrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
.....
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Next steps:
- Run `brew help` to get started
- Further documentation:
https://docs.brew.sh
终端输出如上信息即可。
2. 使用osx系统自带的homebrew来安装jenkins
brew install jenkins
Updating Homebrew...
jenkins: Java 1.8 is required to install this formula.
JavaRequirement unsatisfied!
You can install with Homebrew Cask:
brew cask install homebrew/cask-versions/java8
You can download from:
https://www.oracle.com/technetwork/java/javase/downloads/index.html
Error: An unsatisfied requirement failed this build.
会报错,终端输入如下命令,升级java:
brew cask install homebrew/cask-versions/java8
...
==> Verifying SHA-256 checksum for Cask 'java8'.
==> Installing Cask java8
==> Running installer for java8; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:
installer: Package name is JDK 8 Update 192
installer: Installing at base path /
installer: The install was successful.
🍺 java8 was successfully installed!
3.继续安装jenkins
brew install jenkins
Updating Homebrew...
==> Downloading http://mirrors.jenkins.io/war/2.157/jenkins.war
==> Downloading from http://ftp-chi.osuosl.org/pub/jenkins/war/2.157/jenkins.war
######################################################################## 100.0%
==> jar xvf jenkins.war
==> Caveats
Note: When using launchctl the port will be 8080.
To have launchd start jenkins now and restart at login:
brew services start jenkins
Or, if you don't want/need a background service you can just run:
jenkins
==> Summary
🍺 /usr/local/Cellar/jenkins/2.157: 7 files, 76.0MB, built in 31 seconds
4.设置开机启动
ln -sfv/usr/local/opt/jenkins/*.plist ~/Library/LaunchAgents
launchctl load~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
5.启动jenkins.
jenkins
6.打开浏览器输入:http://localhost:8080/,
提示输入密码:
查看密码方式:
sudo cat /Users/Shared/Jenkins/Home/secrets/initialAdminPassword
输入本机密码,输出的一串文字,就是密码。
然后将我们得到的password输入到“Administrator password“中,即可进入如下界面,接着安装一些建议的插件(左边的),安装过程中,有的插件可能会安装失败,强烈建议点击右下角的重试,直到把建议安装的都装好。