In this post, we will see how we can effectively install and setup jenkins on MacOS, we will use brew command to perform the jenkins installation which reduces the installation time and also avoids permission issues in Mac.
so let’s get started
Note – make sure you have Homebrew installed.
If brew not installed, then open terminal and type [follow the steps]
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Install jenkins
brew install jenkins-lts
Note – lts – long term support version
Homebrew may updated automatically and then you will get the output as
==> Downloading http://mirrors.jenkins.io/war-stable/2.164.3/jenkins.war ==> Downloading from http://ftp-nyc.osuosl.org/pub/jenkins/war-stable/2.164.3/je ######################################################################## 100.0% ==> jar xvf jenkins.war ==> Caveats Note: When using launchctl the port will be 8080. To have launchd start jenkins-lts now and restart at login: brew services start jenkins-lts Or, if you don't want/need a background service you can just run: jenkins-lts ==> Summary /usr/local/Cellar/jenkins-lts/2.164.3: 7 files, 77.3MB, built in 52 seconds
Install a specific LTS version: brew install jenkins-lts@YOUR_VERSION
Start the Jenkins service: brew services start jenkins-lts
Restart the Jenkins service: brew services restart jenkins-lts
Update the Jenkins version: brew upgrade jenkins-lts
Update the jenkins-lts.plist file
Now navigate to this path and open /usr/local/opt/jenkins-lts/homebrew.mxcl.jenkins-lts.plist file
find below line
<string>--httpListenAddress=127.0.0.1</string>
and change to
<string>--httpListenAddress=0.0.0.0</string>
Start the jenkins server
If you want to keep the jenkins running all the time [jenkins will start automatically if you turn on your system], then run command
brew services start jenkins-lts
else, just run command
jenkins-lts
You will get below result
==> Successfully started `jenkins-lts` (label: homebrew.mxcl.jenkins-lts)
Open jenkins
Now navigate to the browser and type localhost:8080
Unlock jenkins
Browser will indicate you to navigate to a hidden folder
/Users/MacUser/.jenkins/secrets/initialAdminPassword
To make the hidden folder visible in mac, navigate to your user folder and type key press combination Command + Shift + >
under the .jenkins | secerts folder, open the InitialAdminPassword file and copy the password and paste into browser, click Continue
Install recommended plugins
Create a user
and you are done
Note – To restart the jenkins server
brew services restart jenkins-lts
If you are on Windows OS, refer jenkins on windows OS
Ok so the file homebrew.mxcl.jenkins-lts.plist is empty. There is nothing in there.
We had the same issues on MacBooks and this is what fixed it.
run this:
chmod u+w /usr/local/var/log
and then run this:
sudu chown -R $(whoami) /usr/local/var/log
then:
brew install jenkins-lts
and it worked