Work with Jenkins on Mac OS 10.+/Ubuntu 16.10

Based on https://wiki.jenkins.io/display/JENKINS/Thanks+for+using+OSX+Installer

Changing boot configuration

Mac OS

The launch daemon picks up the command line options from a standard preferences file, /Library/Preferences/org.jenkins-ci.plist. If the file does not exist, built-in defaults are used. The preference files are manipulated using the standard utility defaults.

  • To view all settings in the file, run: defaults read /Library/Preferences/org.jenkins-ci
  • To get the value of a single setting, run: defaults read /Library/Preferences/org.jenkins-ci SETTING
  • To set the value of a setting, run: sudo defaults write /Library/Preferences/org.jenkins-ci SETTING VALUE

On Ubuntu when installed through apt-get/dpkg

  • sudo nano /etc/default/jenkins
  • sudo nano /var/lib/jenkins/config.xml

Supported Settings

The list of settings supported by the Jenkins launch daemon (see documentation):

  • prefix
  • httpPort
  • httpListenAddress
  • httpsPort
  • httpsListenAddress
  • ajp13Port
  • ajp13ListenAddress

Additionally, you can set also these:

  • war (Full path name to jenkins.war file.)
  • heapSize (Passed to java command-line -Xmx parameter.)
  • permGen (Passed to java command-line -XX:MaxPermSize parameter.) (SINCE 1.455?)
  • JENKINS_HOME (Full path to JENKINS_HOME directory where Jenkins keeps its files)

Starting/stopping the service

Mac OS

  • To manually start the daemon: sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
  • To manually stop the daemon: sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

Ubuntu

  • sudo /etc/init.d/jenkins restart

Show the Jenkins log

sudo cat /var/log/jenkins/jenkins.log

    Update Jenkins

    Ubuntu

    You can overwrite the existing jenkins.war file with the new one and then restart Jenkins. This file is usually located in /usr/share/jenkins. If this is not the case for your system, in Manage Jenkins -> System Information, it will display the path to the .war file under executable-war.

    Mac OS

    • Download the latest war of Jenkins from the website
    • Stop the Jenkins daemon: in a Terminal window, type
    sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
    
    • Copy the downloaded "war" from your download directory to the "/Applications/Jenkins/" folder.
    • Start the Jenkins daemon: in a Terminal window, type
    sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

    Troubleshooting

    The Jenkins configuration still exists in the /Library/LaunchDaemons/org.jenkins-ci.plist, but after the Mac OS upgrade to High Sierra, the user Jenkins disappeared.

    1. So first you must manually create the jenkins user from System Preferences / Users and Groups (Account Name: jenkins, Full Name: Jenkins)
    2. sudo chown -R jenkins /Users/Shared/Jenkins
    3. sudo chown jenkins /var/log/jenkins
    4. sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
    5. sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist