Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Jenkins LaunchAgent and scripts for El Capitan
# Can be more or less complicated depending on your CLI needs.
export HISTCONTROL=erasedups
export HISTSIZE=5000
shopt -s histappend
export VISUAL=less
export EDITOR=vim
export CLICOLOR=1
export LSCOLORS=dxfxcxdxbxegedabagacad
### HOME BREW ###
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
### add /usr/libexec/ to path
export PATH=/usr/libexec:$PATH
### add ./ to path ###
export PATH=.:~/bin:$PATH
### RUBY ENV ###
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
if [ -d /usr/local/etc/bash_completion.d ]; then
. /usr/local/etc/bash_completion.d/git-completion.bash
. /usr/local/etc/bash_completion.d/
#!/usr/bin/env bash
# Assumes Java 8
# Install to /Users/jenkins/bin/
source /Users/jenkins/.bashrc
javaArgs="-Dfile.encoding=UTF-8 -Dhudson.util.ProcessTree.disable=true"
javaArgs="$javaArgs -XX:MetaspaceSize=1024m"
javaArgs="$javaArgs -XX:MaxMetaspaceSize=2048m"
javaArgs="$javaArgs -Xms512m"
javaArgs="$javaArgs -Xmx1024m"
export JENKINS_HOME="/Users/Shared/Jenkins"
echo "Jenkins command line for execution:"
echo /usr/bin/java $javaArgs -jar "$war"
exec /usr/bin/java $javaArgs -jar "$war"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">


These are incomplete instructions; I don't have the time to reproduce the procedure exactly.

  1. Create a jenkins user. Make the user an admin.
  2. Use the official Jenkins installer from the website.

Setup the environment

# 1. Install /Users/jenkins/.bashrc and then symlink:

$ cd /Users/jenkins
$ ln -s .bashrc .bash_profile

# 2. Create the log file
$ touch Library/Logs/jenkins.log

# 3. Create the ~/bin/ dir and install the
$ chmod +x ~/bin/

# 4. Change permissions on /Application/Jenkins/
$ sudo chown -R jenkins:admin /Application/Jenkins

# 5. Remove the LaunchDaemon
$ sudo launchctl stop org.jenkins-ci
$ sudo launchctl unload -F /Library/LaunchAgents/org.jenkins-ci.plist

# 6. Find all the artifacts of the original install and remove.
* /Library/Application Support/Jenkins
* /Library/LaunchDaemons/org.jenkin-ci.plist
* There is preferences plist
* There is a run script

# 7. Install LaunchAgent
$ ls -al /Library/LaunchAgents/org.jenkins-ci.plist
-rw-r--r--  1 root  wheel  855 Nov 17 11:30 /Library/LaunchAgents/org.jenkins-ci.plist
$ sudo launchctl load -wF /Library/LaunchAgents/org.jenkins-ci.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.