Varun Bali
Varun Bali

Reputation: 183

How to start Jenkins server on OSX on boot

I have installed Jenkins on a Mac mini running Sierra using Homebrew but whenever I restart the computer I am unable to connect to it from another computer on the same LAN. I have to manually run the command jenkins in terminal to launch it & then it works. I followed various tutorials about LaunchDaemons & my plist file is present in that folder. I am not a Mac expert so can someone please guide me step by step? I just want to have it up & running automatically whenever the system reboots.

Upvotes: 0

Views: 1454

Answers (2)

Duncan Wallace
Duncan Wallace

Reputation: 1

Create this file: /Library/LaunchDaemons/com.jenkins.plist

  • cd /Library/LaunchDaemons
  • touch com.jenkins.plist
  • sudo touch com.jenkins.plist
  • chmod go+wx com.jenkins.plist

Add the below to the file:

<?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>com.jenkins</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/java</string>
        <string>-jar</string>
        <string>/opt/homebrew/opt/jenkins-lts/libexec/jenkins.war</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
</dict>
</plist>

  • chmod go-wx com.jenkins.plist
  • Restart MAC server
  • Verify Jenkins is running launchctl list | grep jenkins after reboot as intended.

NOTE: This location changes so verify the jenkins.war is located there: /opt/homebrew/opt/jenkins-lts/libexec/jenkins.war

Upvotes: 0

Varun Bali
Varun Bali

Reputation: 183

Got the answer after much brain-wracking.

  1. Installed Jenkins via Brew but stopped its service.
  2. Created plist & saved it in LaunchDaemons folder with the filepath of version 2.66. The irritating thing is updating the path of Jenkins everytime it gets updated.
  3. Launched it via sudo launchctl command.

Upvotes: 0

Related Questions