650 questions
111
votes
9
answers
156k
views
What's a clean way to stop mongod on Mac OS X?
i'm running mongo 1.8.2 and trying to see how to cleanly shut it down on Mac.
on our ubuntu servers i can shutdown mongo cleanly from the mongo shell with:
> use admin
> db.shutdownServer()
...
61
votes
10
answers
58k
views
what does launchd status 78 mean?? why my user agent not running??
I want to run a unison sync service running in the background whenever I login. But the status code of my agent is 78. I don't know why, I tried some fix posted online, but it just doesn't work.
What'...
49
votes
10
answers
31k
views
Missing certificates and keys in the keychain while using Jenkins/Hudson as Continuous Integration for iOS and Mac development
I'm trying to improve Hudson CI for iOS and start Hudson as soon as system starts up. To do this I'm using the following launchd script:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ...
45
votes
4
answers
79k
views
Scheduling a terminal command or script file to run daily at a specific time Mac OS X
I want to have my computer set its volume to a specific level every night at 11:45 PM. I'm running OSX 10.11.4. I can set the volume manually through terminal with
osascript -e "set Volume 1.7"
or ...
44
votes
6
answers
36k
views
jenkins on Mac, PATH is not set right, no /usr/local/bin
I recently installed Jenkins, using Homebrew. I also installed Mercurial using Homebrew.
I can successfully clone an hg repo just fine - from Terminal. But if I try and do the same thing as part of a ...
42
votes
6
answers
51k
views
How can I debug a Launchd script that doesn't run on startup?
I have some launchd scripts from Homebrew. However I have to manually run them when I restart my computer:
launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
<?xml version="1.0&...
40
votes
3
answers
16k
views
Can't make postgresql load at startup in Mac OS
I have installed postgresql via HomeBrew. It worked but today I find that postgresql server does not run when computer start.
I try to use launchctl to load it again with below command:
$ launchctl ...
39
votes
3
answers
52k
views
VERY simple Launchd plist not running my script
I'm trying to figure out why my launchd script is not working. It is extremely simple, but I am new to the mac environment and trying to get accustomed. Here's my plist. I know ProgramArguments is ...
38
votes
8
answers
31k
views
How to know a specific launchd .plist file location?
Is it possible to know the .plist file location which is loaded by the launchctl command?
The label name is listed with launchctl list and its contents can be viewed by launchctl list LABEL, but I ...
37
votes
3
answers
12k
views
How to limit memory of a OS X program? ulimit -v neither -m are working
My programs run out of memory like half of the time I run them. Under Linux I can set a hard limit to the available memory using ulimit -v mem-in-kbytes. Actually, I use ulimit -S -v mem-in-kbytes, so ...
27
votes
1
answer
41k
views
How to check if launchd has started the script?
I configured the launchd to start a command at 18pm every day on my mac pro,but it was not working.
I want to check if the launchd has run the command. I tried the system console, found no anything ...
24
votes
1
answer
1k
views
Cannot access keychain item after SMJobBless update
We have a problem with updating a helper tool with SMJobBless that has been puzzling us for days now.
We are developing an application for which at some point we need to perform administrative tasks (...
21
votes
3
answers
16k
views
Bash – How should I idle until I get a signal?
I have a script for launchd to run that starts a server, then tells it to exit gracefully when launchd kills it off (which should be at shutdown). My question: what is the appropriate, idiomatic way ...
19
votes
1
answer
10k
views
What are the OS X session types, and what do they mean?
I've been trying to find out the meaning of LimitLoadToSessionType in launchctl on OS X (Lion).
After scouring the internet, it seems the value can be one of:
Aqua, LoginWindow, Background, ...
18
votes
3
answers
11k
views
Unable to sign iOS builds with Jenkins
Our Jenkins CI build server is set up on a Mac Mini running OSX Lion (10.7.3), and I'm having trouble getting it to sign the iOS builds so they can be uploaded to to TestFlight.
The process is ...
18
votes
4
answers
21k
views
launchctl - remove enabled/disabled override
On OS X Yosemite (10.10), is there any way to remove the enabled/disabled override setting for a service?
For example, to permanently disable non-existent service 'test' for root, do this:
sudo ...
17
votes
3
answers
13k
views
What's the difference between 'Day' and 'Weekday' in launchd StartCalendarInterval?
I'm working with launchd to run some automated tasks, and I was wondering what the difference is between 'Day' and 'Weekday'.
According to http://discussions.apple.com/thread.jspa?threadID=1361809 ...
13
votes
0
answers
2k
views
How should I clean up the launchd StandardOutput or StandardError logs?
I've got a program that runs as a launchd agent, and I have stdout and stderr sent to a log file using the StandardErrorPath and StandardOutputPath keys. I'm quite keen on having stdout/stderr logged ...
12
votes
3
answers
16k
views
Run a shell script periodically on Mac OS X without root permission
I want to start up a file with .sh type or .py on mac os x without using root ,
I searched in google and found launchctl can help me ,
so i read tutorial and do same in tutorial but it not work for ...
12
votes
1
answer
23k
views
Making Mac OSX launchctl launch a process as root on startup
My question is how to make a MacOSX daemon process using launchd start with root privileges automatically after a reboot?
I'm writing an application for in house use that blocks access to web sites. ...
12
votes
4
answers
10k
views
Starting/stopping a launchd agent for all users with GUI sessions
I need to be able to start/stop a per-session GUI agent from a root level daemon.
Similar issues are discussed here, here and here.
What I want to be able to do is basically
for num in `ps ax | ...
12
votes
1
answer
18k
views
running a shell script automatically with launchd on Mac
I'm trying to get a script to run every day at the same time to restart a Mac. I cannot use the built in schedule feature in the energy saving preference panel because I have apps running that prevent ...
12
votes
1
answer
2k
views
launchctl sub commands load and unload says its legacy sub commands on mac os x 10.10. how to replace this sub commands with other
I have found that the launchctl sub commands like load/ unload listed in legacy sub commands on mac os x 10.10.
So my question is how to launchctl to load/unload demons present at /Library/...
11
votes
2
answers
5k
views
SMJobBless failed with CFErrorDomainLaunchd Code 9
Does anybody know what does that error code mean?
I get SMJobBless error with this return code value.
Failed to bless helper: Error Domain=CFErrorDomainLaunchd Code=9 "The operation couldn’t be ...
11
votes
5
answers
9k
views
setenv variable with spaces in launchd.conf?
I'm a Linux user that just recently got a mac. I'm trying to set up my IDE and found out that Macs don't use .bashrc / .bash_profile / etc. for GUI apps. So, if you have a GUI app that needs an ...
11
votes
2
answers
13k
views
MacOS: Manually force a daemon to start
I've created a plist file in the /Library/LaunchDaemon/
The computer on which it runs cannot be restarted (server thing), it's running MacOS Tiger. I expected the following command to do the job, but ...
11
votes
2
answers
4k
views
Mac OS X daemon using Objective-C - launchd
I'm new in Mac OS X world but I have skills on Windows dev.
I need to develop a daemon (on Windows will be Windows Service) that uploads/downloads files from a Web Service.
My question is: is it ...
11
votes
1
answer
4k
views
Binding on privileged ports (ports < 1024) on Mac OS X 10.6
Do you know how to remove restriction on binding to ports < 1024 with a user account that is not root on Mac OS X?
11
votes
1
answer
3k
views
Is it possible to detect Power Nap / DarkWake mode in OSX
I have a daemon process started via launchd. This will be running even during DarkWake and has no time to finish before OS X goes back to sleep again.
I can think of the following solutions, but ...
10
votes
5
answers
10k
views
OSX service started via launchd plist can't find executable
I am trying to write a launchd.plist file for my node server. I am using forever to run my node server. I would like the server to start on boot. I would also like to wait for the mongodb launchd ...
10
votes
6
answers
19k
views
How to remove pm2 from startup (on mac)
I experimenting with pm2, which is a process manager for node.js applications. I tried their pm2 startup utility which generates and installs a startup script for pm2 when the system restarts.
I ...
9
votes
1
answer
3k
views
Mac Launch Daemon unable to retrieve password from system keychain after saving it there
We have a Launch Daemon which (necessarily, for various reasons) runs as root, and which communicates with a server component via the network. It needs to authenticate with the service, so when it ...
9
votes
2
answers
4k
views
iPhone SDK strange console message launchd_core_logic.c
I am running release version of the app on the iPhone, it works fine. There is no error messages in the XCode debugger:
Running…
Switching to thread 11779
Switching to thread 11779
sharedlibrary apply-...
9
votes
2
answers
6k
views
Running Launchd Services with Non Root User on macOS
I am building a launchctl service which can run a java service. I am able to create launchctl service with root user and test start/stop/status/automatic start at reboot use cases.
I am struggling ...
9
votes
7
answers
10k
views
MacPorts Apache2 Stopped Launching on Boot
Something that I've noticed recently on two different machines is that Apache2 installed via MacPorts seems to have stopped launching when I boot up. The honest truth is that I can't swear it did so ...
9
votes
0
answers
890
views
Is there a MacOS (launchd) implementation for IHostLifetime?
Microsoft has defined the IHostLifetime interface for WorkerServices to run as services on different platforms. (You can create a Worker Service project with dotnet new worker in the console).
If you ...
9
votes
1
answer
498
views
Is there a way to update SMLoginItemBookmarks data on launchd overrides.plist
I'm working on an OS X app that most users choose to "launch at login", the kind you'd find at the menu bar.
In order to launch it at login I'm using SMLoginItemSetEnabled to launch a LoginHelper app ...
9
votes
1
answer
1k
views
How does OSX Activity Monitor match XPC tasks to their initiator process?
When an application process launches an XPC helper process, it doesn't actually do the fork()/exec() itself in the classic UNIX style. Instead, it sends a message to launchd, which does the dirty work ...
8
votes
3
answers
24k
views
~/Library/LaunchAgents plist runs manually but not automatically
I am starting to work with launchd and want to set up a plist file such that whenever I insert an SD card into my Mac mini server (with Snow Leopard Server), I want a shell script to run (which should ...
8
votes
4
answers
4k
views
launchd.plist runs every 10 seconds instead of just once
I have been setting up a launchd.plist XML that is run every time a specific USB device is mounted. I followed the instructions on the xpc_events(3) man page and it is running the application whenever ...
8
votes
3
answers
8k
views
running sudo command in bash script and running it with launchd
I have a bash script that I would like to run with a launchd plist file on OS X. The problem I have is is that the bash script contains sudo commands and it is stopping it from running. So for example ...
8
votes
2
answers
4k
views
How to access environment variables in launchd plist
I have a launchd per-user agent. In it's .plist, I would like to use the $HOME environment variable.
Is it possible?
(it is the "Program" key, which I would like to define as "$HOME/bin/myscript")
8
votes
2
answers
4k
views
What is CFErrorDomainLaunchd error 2?
I can't find CFErrorDomainLaunchd in any of the headers. I used the
find command to grep every header file in the 10.11 SDK.
I also tried google:
site:opensource.apple.com CFErrorDomainLaunchd
...
8
votes
1
answer
4k
views
launchd: Confusion on the sematics of bootstrap/bootout for controlling services on macOS
I've read the following manual pages on launchd: launchctl, launchd, and launchd.plist.
However, nothing is really said in these manual pages regarding what the launchctl boostrap and launchctl ...
8
votes
4
answers
7k
views
Running python script in Mac OSX launchd permission issue
I have a simple python script which is moving files from my download folder. The script works fine when I running it via terminal. The issue happens when it gets run through launchd:
Traceback (most ...
8
votes
3
answers
6k
views
How can I create a launchd agent that will run only once?
Since there is no "Year" parameter in the launchd plist format, how is it possible to create an agent that will run only once and not once a year?
8
votes
2
answers
3k
views
Using a LaunchAgent inside the Mac app sandbox
How would you use a LaunchAgent inside the sandbox? I want to distribute a UI-less LaunchAgent app bundle inside my main application that I can launch on demand. The reason I want this instead of an ...
7
votes
3
answers
10k
views
How can I add arguments to OSX launchd plist to pipe output to a log file?
I have tried many different variation on this but just can't get it to work.
I have a plist file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" ...
7
votes
2
answers
5k
views
Removing mysql using launchctl
I am trying to uninstall my old sql so that I can install a new one. I am following this post but stuck at launchctl unload.
[~/Library/LaunchAgents]$ ls com.adobe.ARM....
7
votes
2
answers
16k
views
How to check for a launched process is loaded or not in MAC OS X from shell script?
I have a launchd process to unload, the command I have used is
launchctl unload /System/Library/LaunchDaemons/costomscript.plist
it works fine if the process is already loaded. But if it is not ...