I'm a techie but fairly new to macOS. I am using a Mac mini running macOS Sierra as a build machine running GoCD. I want the server (go-server) and the agent (go-agent) to start on boot, but I can't find an easy explanation anywhere for how to do this.

Things that worked on Mac OS X 10.6 don't work any more, and I don't want to have these apps start at login, because I don't want to remain logged into the console on this computer.

  • Have you looked at launch services/daemons?
    – At0mic
    Oct 8 '16 at 0:07
  • @dante12 Please read the question: DrS explicitly doesn't want to start the app/service at login but at boot time.
    – klanomath
    Oct 8 '16 at 11:16

Service/app launch while booting is usually done with launchd and launch daemons controlled by launchctl. It depends on the app/executable and the environment if such a launch daemon is possible or not. A lot of GUI apps require a login session and the method doesn't work.

After inspecting GoCD you can either download a zip file or an "OS X/macOS app" version of the server. The server is started with a shell script in both cases: either explicitly in the zip version or implicitly with "Go Server.app/Contents/MacOS/go-server".

Go with the zip file, unzip it and move the resulting folder to /usr/local. Link the folder /usr/local/go-server-16.10.0 to /usr/local/:

ln -s /usr/local/go-server-16.10.0 /usr/local/go-server

Create a launch daemon with sudo nano /Library/LaunchDaemon/org.goserver.start.plistand the content

<?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">

Change owner and permissions of the file if necessary:

sudo chown root:wheel /Library/LaunchDaemons/org.goserver.start.plist
sudo chmod 644 /Library/LaunchDaemons/org.goserver.start.plist

Modify /usr/local/go-server-16.10.0/server.sh to your needs. You should set a different log directory in line 85 or a log file will be created in the root directory. Check other variables and paths (like $JAVA_HOME, YOURKIT_PATH, $PID_FILE etc) in the shell script and modify them according to your needs/environment. Here it worked out-of-the-box - but I didn't test it thoroughly.

Then start the launch daemon with:

sudo launchctl load /Library/LaunchDaemons/org.goserver.start.plist

Check /tmp/org.goserver.start.stderr for launchd errors. If the launch daemon runs well you may remove the part:


from the plist.

The method should work accordingly with the GoAgent. The start of the agent is done with agent.sh. Use a second plist with a different plist and label name of course: org.goagent.start.plist/org.goagent.start.

You probably have to add a condition in the agent's plist so that the agent is started after the server is running.

I tried the same with the "OS X" app but I failed to eliminate all errors.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .