Jenkins setup on OSX

Apphance Flow should work with any Continuous Integration system. Our CI server of choice is Jenkins and this part of documentation describes how to set it up. But the steps below should be pretty similar when installing other CI software.

You can follow the step by step tutorial below for Jenkins for other CI software you should test it your self.

Installing Jenkins

In this document we describe the simplest possible installation on one machine. For more complex setups (i.e. using jenkins slaves) please see the official documentation at

OSX gatekeeper

Jenkins can be easily installed using native installer . Before you begin installation you have to disable OS X Gatekeeper feature. Otherwise you will see following error:


To disable Gatekeeper you should:
Open system preferences, open “Security & Privacy” section. Unlock changes by clicking lock in left corner and select “Anywhere” in “Allow applications downloaded from:” section:


In order to be able to run jenkins, java 7 must be installed. 

Java 7 can be installed using Oracle's installation instructions.

Note! Jenkins startup script (nor jenkins installer) will not warn you that java is not installed it just silently won’t start if you forgot this step!

After disabling sandboxing and java installation you can install jenkins from pkg.


Setting user jenkins password

Jenkins installer adds jenkins user, but you have to manually set the password. You can do this with following command:

sudo passwd jenkins

Setting jenkins auto login.

To be able to run test on simulator you have to setup auto login as jenkins user. Open “Users & Groups” section in OS X settings and select “Login Option” The tricky part is that jenkins user is not labeled:



Setting up jenkins user as administrator

Boxen software (which we are using to install additional software) requires sudo permissions to install. You have to open “Users & Groups” preferences and check “Allow user to administer this computer” checkbox:



Home dir symlink creation

Jenkins creates its user dir at /Users/Shared/Jenkins. Some command line tools assumes that home dir is at /Users/jenkins. You have to make symlink:

sudo ln -s /Users/Shared/Jenkins /Users/jenkins
sudo chown jenkins:jenkins /Users/jenkins


Setting up node environment variables

The unlockKeychain task requires OS_KEYCHAIN_LOCATION and OSX_KEYCHAIN_PASSWORDS variables. If you use Login Keychain (default) then keychain password is the same as Jenkins user password. Both variables should be set in Jenkins's configuration (Jenkins -> Manage Jeknkins -> Configure System in single master environment or <node name>/Configure in master/slave environments) section. 
Similarly if you will configure mail server on your Jenkins you need to setup MAIL_SERVER and MAIL_PORT environment variables.


Setting up PATH variable for Jenkins

In order to be able to use command line tools installed with homebrew/boxen you have to edit jenkins startupscript:
vim /Library/Application\ Support/Jenkins/jenkins-runner.sh
and add source /opt/boxen/env.sh atter #/bin/bash  then restart jenkins:

sudo launchctl stop org.jenkins-ci
sudo launchctl start org.jenkins-ci

Next steps

Follow to Jenkins Plugins part.
Comments