Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am setting up an app called Jenkins on the Mac which is a build tool.

There are many VERY helpful articles on this topic and they all involve modifying a plist to point to a newly created user.

They ALL say to start/stop using sudo

 sudo launchctl unload -w /Library/LaunchDaemons/org.jenkins-ci.plist
 sudo launchctl load -w /Library/LaunchDaemons/org.jenkins-ci.plist

and they all say to create a NEW user for this purpose (how about an existing user?)

sudo dscl . create /Users/jenkins
sudo dscl . create /Users/jenkins PrimaryGroupID 1
sudo dscl . create /Users/jenkins UniqueID 300
sudo dscl . create /Users/jenkins UserShell /bin/bash
sudo dscl . create /Users/jenkins home /Users/Shared/Jenkins/Home/
sudo dscl . create /Users/jenkins NFSHomeDirectory /Users/Shared/Jenkins/Home/
sudo dscl . passwd /Users/jenkins

Now I am new to mac. And this tells me NOTHING about:

  1. how to make the app/service/daemon startup automatically when restarting the machine.
  2. How does this give the user jenkins the permissions needed?
  3. also I needed to login with one user to change the plist then back in with another user etc.
  4. I don't even see this newly created user in /Users/jenkins at all, although each line executed ok. I don't see /Users/jenkins.
  5. How will starting the machine and loggin in as admin account cause this jenkins user and the daemon to startup? I just don't get it? Do I need to add the sudo to some startup script in the admin.

I mean really this is what I think everyone thinks of when they think of having a daemon process running. Not constantly executing sudo this and sudo that.

I am not at all what will happen if I boot the machine and login with user jenkins. How do I make the jenkins server run no matter which user is actually logged into the machine?

Note: I executed everything from an admin account. Not root.

So I need some complete information on how to do this.

I mean what is the point of a daemon if I need to sudo load each time the machine starts?

Now my exact situation is I already have an admin user jenkinsadmin that I want to use to monitor the machine etc. Creating this new user as above did not give me a user with admin permissions at all. In fact executing sudo was not possible. So how do I auto start this jenkins each time the machine boots and I login with jenkinsadmin?

share|improve this question

You need to tell the Mac that Jenkins has to be startet immediately after a reboot. This is done using the so called LaunchDaemons. For more informations on LaunchDaemons and LaunchAgents have a look at the Daemons and Services page of Apples Developer Resources.

Basically a special file that resides in /Library/LaunchDaemons causes the Mac to start a certain program. If the file includes <key>RunAtLoad</key><true/> the application will start at system boot and you will not have to manually start the process.

You do not need a user with administrative access rights. Just set the user as user for the process in your LauchDaemon-config-file. When the system then starts the process it will start the process as that given user. And even if you start the process manually by running sudo launchctl the process will finaly run as your jenkinsadmin-User.

share|improve this answer
And this is how you properly enable/disable run on startup: sudo defaults write /Library/LaunchDaemons/org.jenkins-ci RunAtLoad -bool NO – Nakilon Sep 1 '15 at 12:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.