KISS

Keep It Simple Stupid

Jenkins doesn't run as a LaunchAgent?

| comments

If you are interested in Jenkins and followed my post about setting it up in a virtual machine, you should be totally fine. However, when I was messing with it, I had an issue when the jenkins agent wouldn’t start:

1
2
3
launchctl load ~/Library/LaunchAgents/org.jenkins-ci.plist
launchctl load ~/Library/LaunchAgents/org.jenkins-ci.plist
/Users/Shared/Jenkins/Library/LaunchAgents/org.jenkins-ci.plist: Operation already in progress

Operation already in progress implies the agent is already running, even though:

1
pgrep -fil jenkins

prints nothing, which means no jenkins process runs. There is nothing is the Console.app logs.

Turns out the issue is that I accidentally used the sudo launchctl load … command before, and the logs in /var/log/jenkins/ had the root permissions. Jenkins (or is it launchd?) doesn’t want to start in that case. So you’ll need to do this:

1
2
launchctl unload ~/Library/LaunchAgents/org.jenkins-ci.plist
sudo chown jenkins /var/log/jenkins/*

The second command reverts the log files ownership back to the jenkins user. Now launchctl load works fine. Enjoy!

Comments