Questions tagged [launchd]

A system for starting, stopping, and managing automated processes.

Filter by
Sorted by
Tagged with
6
votes
3answers
7k views

launchd plist format for running a command at a specific time on a weekday

I'm trying to run a command at 10 minutes after 2am every weekday only. In my launchd .plist file, how can I specify this? I don't want it to run every 2 hours and 10 minutes, just once every ...
19
votes
4answers
11k views

Which command controls the open file limits?

Which command / configuration file controls the open file limits on OS X? Is there a different command for OS X 10.5 / 10.6 / 10.7? The options I explore below are ulimit, sysctl, and launchctl "...
121
votes
14answers
109k views

runaway distnoted process

Sometimes I see a distnoted process suddenly spin up and chew up 100% CPU (on one core) and a ton of memory, often in the neighborhood of 1.5G or so. This happens a few times a day, starting a month ...
11
votes
3answers
15k views

How do I restart the cron service on OSX?

ProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G31 $ sudo cron restart cron: cron already running, pid: 257` None of the answers in here https://stackoverflow.com/questions/...
8
votes
7answers
4k views

How to run a LaunchAgent that runs a script which causes failures because of System Integrity Protection

After upgrading to Mojave, my rsync based backup script run via a launch agent in ~/Library/LaunchAgents, could no longer read some directories in ~/Library.
8
votes
3answers
2k views

“cron” processes spawning and piling up, but no crontab

EDIT: I solved this, so see below for my own answer. While the bounty asks for a fix to the problem, I'd like to award it to someone who can explain why a cron process that ran for 6 years over ...
29
votes
4answers
65k views

Stopping LaunchAgents and Daemons

I work as admin in a college environment. One of the challenges is to stop the services installed by students with CS major. Some time back they got the admin access and installed launch agents and ...
2
votes
1answer
3k views

Setting a static route every boot with launchd / plist is failing

I hope to use launchd to set a static route on a server at boot time since I haven't figured a better way to configure this sort of networking on a server. My problem is that the command seems to be ...
64
votes
4answers
74k views

How to disable Adobe Core Sync app on OS X from being launched automatically?

I have noticed a lot of Adobe processes are running in the background at start up on an OS X 10.11.4 (15E65) machine with Adobe Creative Cloud (CC) installed. To get rid of this, I removed everything ...
54
votes
5answers
47k views

Why am I getting a “dubious ownership of file” error when Launch Agent runs my .plist file?

I have a Launch Agent configured to run a .plist file for example: /Library/LaunchAgent/foo.plist. Inside this .plist, it is set to run during LoginWindow and Aqua. When I attempt to launch my ...
11
votes
4answers
13k views

Run Script on Logout Without Use of Logout Hook

I've been looking into running a few cleanup commands when a user logs out, however the old logout hook feature, although still functioning, has been deprecated for some time now so may not be with us ...
19
votes
4answers
6k views

Can anyone recommend a good tutorial for writing (from scratch) a cron-style launchd job?

I've got a fairly simple job that I'd like to run every hour. I could do it using cron, but I thought I'd use this to learn about launchd, since I hear good things about it. I've got the man launchd....
53
votes
1answer
87k views

How to show all running launchctl daemons/agents?

When I run: sudo launchctl bslist ... it shows all the running /System daemons, but I have some running from /Library/LaunchDaemons and it is not showing those. How can I show them all?
19
votes
6answers
9k views

Run bash script at login stored in the home folder?

When I try to load a LaunchAgent plist from launchctl I can't find out how to run a script in the home directory. My code is: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-...
14
votes
1answer
2k views

I mistakenly disabled all services in Yosemite (10.10), now it can't boot

I ran: sudo launchctl unload -w /System/Library/LaunchDaemons/ by mistake, now my Mac does not boot... Any idea how to fix that? OS version: Yosemite.
6
votes
2answers
3k views

How to mount a RAM disk on startup?

I'm trying to mount a RAM disk on startup with this: /Users/Aram/Development/Tools/ramdisk.sh diskutil erasevolume HFS+ "RamDisk" `hdiutil attach -nomount ram://800000` com.aram.ramdisk.plist <?...
3
votes
1answer
2k views

How to automate execution locate.updatedb by using a bash script

I am looking for a bash set of commands that will enable me to schedule the execution of /usr/libexec/locate.updatedb once every day. Please respond only with a set of command line commands, because ...
2
votes
1answer
2k views

MacOS 10.10 on 4 GB memory bloat: which launch daemons/agents/services can I disable? And how to discover the names of the culprits?

I recently did a Yosemite (10.10) clean install on my 4 GB 2010 MBP, but it now has so much memory bloat due to unnecessary launch daemons/agents /services that it causes frequent beachballing; ...
18
votes
2answers
20k views

Getting launchd to read program arguments correctly

I have a launchd script where the command I'm trying to run is erroring (apparently that's not a word, it is now), complaining of improper usage. The specific error I'm getting is the command's usage ...
8
votes
3answers
7k views

How to properly increase a `ulimit -n` limits?

I'm trying to download the X-Plane 10 Demo through uTorrent, however I get a "too many open files" error all the time. I can do the alternate download (which takes forever and a day), but I wonder how ...
7
votes
5answers
1k views

How to stop an app from launching on Login?

I have created an app, that sets itself to launch at Login using SMLoginItemSetEnabled. Here is the code it uses. My question is, how can I manually remove this app from launching at login? The app ...
4
votes
1answer
595 views

In Mountain Lion why do remote shells via ssh do NOT inherit the environment of the launchd parent process?

When logging in to my Mountain Lion Mac remotely via ssh I do not get the same PATH variable as when I open a shell locally: The local shell inherits its environment as expected from launchd and ...
2
votes
1answer
9k views

Disable Screen sharing via the command line in mountain lion

I want to be able to enable and disable screen sharing from the command line rather than through System Preferences. This is on 10.8.3 To enable screen sharing, I find I only need to change a ...
2
votes
1answer
156 views

Using launchd to update MacPorts

I want to use launchd to update my MacPorts tree periodically (i.e. port selfupdate. I have created /Library/LaunchDaemons/org.macports.selfupdate.plist: $ ls -l /Library/LaunchDaemons/org.macports....
2
votes
1answer
541 views

Monitor Folder Contents with launchd - Including Subfolders?

I want to make a shell script that runs any time the contents of a particular folder on my server are changed. Seems easy enough at first, because launchd has a directive called WatchPaths which ...
13
votes
1answer
2k views

What is the relationship between `launchctl limit` and `ulimit`?

There is not any ulimit configuration in system startup files/ shell startup scripts. ulimit -a shows: -u: processes 1064 -n: file descriptors 256 launchctl ...
5
votes
2answers
498 views

How to I stop a launchd script from running on wake

I have a simple launchd script that plays a sound every 30 minutes and it runs out of the user library ~/Library . It doesn't run if my machine is asleep, but does run the last event missed when the ...
3
votes
3answers
406 views

Configure launchd

I have a launchd plist in ~/Library/LaunchAgents designed to run a script located at ~/writout.sh every day at 10:30AM: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//...
3
votes
1answer
2k views

How to run a command at startup

I want to automatically start my MongoDB Server at startup. The command for it is mongod --dbpath="/Users/prateek/Desktop/Mongo Database" How do I configure this in Mac OSX El Capitan? Note - I ...
2
votes
1answer
1k views

Bash Script which calls osascript stops working when run by launchd

I am trying to troubleshoot a problem with a bash script that gets called by launchd. Here's a quick summary Calling the script manually by itself works fine with no errors. Within the bash ...
2
votes
1answer
2k views

prevent launchctl from starting a anonymous process

I have installed dnsmasq and now I want to be able to start it with launchctl. The problem is that every time I start the app launchctl starts an anonyous process instead of using the specified label. ...
1
vote
1answer
2k views

Mail does not work in scripts launched with launchd

I'm using this setup to be able to send mail from Terminal: http://www.anujgakhar.com/2011/12/09/using-macosx-lion-command-line-mail-with-gmail-as-smtp/ It works great, and I can use it in scripts. ...
0
votes
2answers
329 views

Can't start tftpd because port is already in use by launchd

Enabling tftpd sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist Start: sudo launchctl start com.apple.tftpd See logs syslog -w com.apple.xpc.launchd[1] (com.apple.tftpd[30687]) <...
37
votes
2answers
18k views

Launchctl difference between load and start, unload and stop

I was reading through the launchctl man page and have a few questions about its functioning: What is the difference between load and start, unload and stop? Where do I find the job label for a daemon,...
30
votes
1answer
13k views

What is the difference between a `service-name` and a `service-target`?

Consider the following commands # launchctl stop Usage: launchctl stop <service-name> # launchctl stop com.apple.SomeService # launchctl disable com.apple.SomeService Usage: launchctl disable &...
22
votes
6answers
68k views

How do I remove or disable AdobeIPCBroker?

A new unstable resource-draining Adobe process that has recently appeared on my Mac is proving more difficult to hunt down and kill than the numerous other processes that Adobe creates. Generally ...
16
votes
1answer
20k views

launchtl: any way to disable a daemon after removing the plist file?

I was trying to permanently disable a 3rd party daemon, so I deleted its plist file from /Library/LaunchDaemons-- and then I realized that I hadn't done a launchctl unload on it first; trying after ...
10
votes
3answers
7k views

Automatically relaunch a closed application

I have an application that opens when I login. Is there a way to relaunch it automatically if it crashes or if I close it inadvertently? (the application in question is Transmission if there is any ...
12
votes
4answers
16k views

How to find out what launch agent or daemon is starting a process

After installing Autodesk Smoke, I have two httpd processes running all the time, and I'd like to stop them. When I use sudo killall httpd, they stop and are restarted right away. Activity Monitor ...
4
votes
3answers
13k views

Why won't kern.maxfiles setting in /etc/sysctl.conf stick?

I've been getting various "too many files open in system"-type errors on Yosemite (10.10.1). Searching around suggests setting kern.maxfiles and kern.maxfilesperprocess in /etc/sysctl.conf. I've ...
5
votes
2answers
4k views

Why does setting the hard-limit for maxfiles to “unlimited” using `launchctl limit` result in a hard-limit slightly above the soft-limit?

Why does setting the hard-limit for maxfiles to "unlimited" using launchctl limit result in a hard-limit slightly above the soft-limit? By setting the maxfiles limit using launchctl to launchctl ...
4
votes
4answers
13k views

Can't delete .plist files from Trash

I have a program which, when deleting any app, also deletes the extra files and junk as well; including .plist files. Normally this works great though, this time around I've had a few files which won'...
1
vote
2answers
1k views

Automatically backup JailBreak iPhone DCIM photo directory

Hi I heard that you can write cron job into plist and put it to JB iPhone /Library/LaunchDaemons folder in plist format I would like to backup the photo folder every 300 seconds, so I put a com....
19
votes
1answer
4k views

Set launchd log level

How can I set the log level of launchd in MacOS Yosemite? I've tried launchctl log level debug but it doesn't work.
9
votes
2answers
6k views

Automatically delete a folder daily

Is there a way to automatically have a folder deleted every day at 4am? I'm running 10.6.7.
7
votes
2answers
14k views

Launchctl says plist is invalid, plutil says it's OK

I'm trying to have launchd run a shell script when I join a new WiFi network. I've created this plist file (closely based on this SuperUser answer) at /Users/myname/Library/LaunchAgents/my....
5
votes
2answers
4k views

Assistive Access when script is launched by agent

Problem Applescript run by osascript is not allowed Assistive Access when launched by agent (~/Library/LaunchAgents). Although it works when run from Applescript editor or commandline directly (using ...
5
votes
1answer
12k views

Running a command whenever Mac boots up with launchctl/plist

I need to run nohup nice synergys -f --config ~/bin/conf/synergy.conf & command whenever the computer boots up. As is written in this post, I came up with the following plist code. <?xml ...
4
votes
2answers
1k views

`ulimit -n` for non-root

I'm running El Capitan / Mac OSX 10.11.6 (15G1108) and I want to increase the "Max Open files" for some of my terminals / bash sessions. I'm logged in with my normal users. I read through all the ...
4
votes
1answer
837 views

launchd StartCalendarInterval not working reliably

I have several tasks that I run from launchd using StartCalendar interval. Under Yosemite these do not necessarily run. (Under Mavericks and earlier they did run) How do I see what launchd is doing ...