Questions tagged [launchd]

launchd is an open-source daemon intended to streamline and accelerate starting and stopping of processes on a *nix OS.

Filter by
Sorted by
Tagged with
1
vote
0answers
27 views

How to find and remove a LaunchAgent which has no .plist

My macOS (v11.2.1) has a number of undesirable LaunchAgents loading with the system, which bloat it. Some of them I was able to successfully remove (just by finding their .plist.) However, for some ...
0
votes
0answers
38 views

launchd plist to run a simple shell script not working. status 126

I'm trying to create a pretty simple launch agent that runs a script as a user at 12:05AM. I think I have the syntax correct, as I've tried a few different templates and even used a Lingon X to ...
0
votes
0answers
34 views

Run a shell script everyday even if mac is asleep at the time

so I have a bash script that I want to run every weekday at 3 and I used crontab already it only works if I happen to be on my computer during the time. I need the script to run when I open my laptop ...
0
votes
0answers
43 views

launchctl plist daemon ProgramArguments wrapped in quotes

I have the following plist file at ~/Library/LaunchAgents/myserver.listen.to.port.plis(server/usernames changed to generics): <?xml version="1.0" encoding="UTF-8"?> <!...
0
votes
0answers
71 views

How to schedule a py program on mac to run every 60 minutes (under a specific folder)

I am new to python and I have written my first program and run it a few times in the day. The file is called quran_review_scheduler.py in a folder under my user directory 'usr/dev/python/...
0
votes
1answer
140 views

How to run a command upon startup of MacOS Catalina?

I have installed SoftEther VPN on my Mac with MacOS Catalina and it works great after I manually start it. Upon a reboot the VPN does not come up though. I currently have to open a Terminal window ...
1
vote
0answers
16 views

MacOS: Launchctl starting Virtual Machine before USB is intitiated

I have a plist file located in /Library/LaunchDaemons that starts a Virtual Machine headless with Ubuntu on it. The problem is however that USB probably isn't initiated before the VM is started, and ...
0
votes
1answer
70 views

Trying to expand arguments for launchdaemon at running time

I have launchd running a shell script at a noontime every day. I am trying to pass in the previous date as an argument for that script in the .plist for my launch daemon, but according to stdout and ...
0
votes
0answers
74 views

MacOS Mojave - LaunchAgent plist doesn't run for all users

I have a plist that I've placed in /Library/LaunchAgents which is designed to, for all users, run a script which launches Parallels. (As I'm running an environment with network users, I don't have the ...
1
vote
0answers
48 views

launchd script never runs again after sleep

The script specified in my launchd configuration works correctly (runs every 10 seconds) so long as my computer does not go to sleep. Once it does, I have to reload the launchd configuration. Here is ...
3
votes
1answer
598 views

Find fails with “Too Many Arguments” in Shell Script, but not if run directly in a Terminal

I have a work station that stores images temporarily before compressed versions are uploaded to a server for safe keeping. I have an interest in deleting old files once a day at 3 AM using a script ...
2
votes
2answers
760 views

How to schedule a run of “docker-compose,” on MacOS, using launchd

I'm building some software with docker-compose, for which I would like to run on a schedule. So I need to schedule a run of docker-compose up, on MacOS (High Sierra, 10.13.3), using launchd. This is ...
1
vote
1answer
3k views

Remove build in Apache httpd on macOS (OSX)

I have a Mac Mini running a private server from home. It is running macos High Sierra (osx) and and previous used "Apple Server" to manage my websites (using the build in apache httpd). But since ...
1
vote
1answer
1k views

Python Script/Unix Executable Runs in Terminal, Fails as Cron/Launchd job

I'm trying to configure launchd to trigger a python script/unix executable (i.e. python script with shebang line). When I load the .plist file (below), launchctl shows a status of 127 meaning, "The ...
0
votes
1answer
198 views

LaunchDaemon script not sending mail

On my macOS 10.13 system, I have a bash script launched as a LaunchDaemon (in /Library/LaunchDaemons) every minute to check whether an Ubuntu virtual machine is running in VMware Fusion. (In the event ...
1
vote
1answer
233 views

How to have a launchd script create a file with time stamp?

I am trying to run a simple launchd script that copies a file from one directory to another when the file changes, but I want to paste it with a unique timestamp so I can version the files. My launchd ...
0
votes
1answer
389 views

How to run a scheduled bash script that requires user input with launchd/cron?

I have a bash script that backs up some files to a remote server using rclone. I want to run this script once every week. The script asks me two questions: it confirms if I want to run it at that ...
2
votes
1answer
1k views

How can I stop a launchd service?

I have a launchd service with label homebrew.mxcl.postgresql: $ launchctl list homebrew.mxcl.postgresql { "LimitLoadToSessionType" = "Aqua"; "StandardErrorPath" = "/usr/local/var/log/postgres....
1
vote
0answers
339 views

Using Launchd for an Applescript Application

I created an Applescript Application (called Print Release) that runs without issue (code below): do shell script "rm -R /Users/<account>/release.zip; rm -R /Users/<account>/release; curl ...
1
vote
1answer
107 views

macOS Sierra: reload firewall when network changes

I've been trying to reload pf rules whenever network changes. Here is my plist file. /Library/LaunchAgents/com.wwk.networkchange.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist ...
0
votes
0answers
71 views

run daemon on start when scheduled time is missed

I have a daemon/script that runs daily, but I can't find a way to make it run if the computer was off at the scheduled time. Specifically, I'd like: run script/daemon once a day at a X:00 am if ...
1
vote
0answers
177 views

Can't use $HOME in launchd.plist

I want to run a shell script at startup. So I have used launchd. Everything works fine if the path to the script is absolute like /Users/mac/shell.sh. But it gives error code 127 when I provide the ...
2
votes
0answers
501 views

ssh daemon listening on port 22

Just curios to understand why there are many entries listening on port 22 when usually one is enough. Thanks for your time. $ sudo lsof -iTCP -n -P | grep LIST | grep 22 COMMAND PID USER FD ...
1
vote
0answers
199 views

Restart a daemon without root in OSX

On OSX 10.10 I created a plist file in /Library/LaunchDaemons/ to start at launch an OpenVPN connection. However I encountered DNS problems when going from an internet interface to another (as WiFi to ...
0
votes
1answer
176 views

Mac OS X - How to delete automatic scripts or application actions?

I've a script installed that regularly executes on the full hour. A friend of mine installed it way back and I finally want to get rid of it. The problem: neither do I know the path to which it was ...
2
votes
1answer
613 views

Can't change SSH_AUTH_SOCK with launchctl setenv

I want to set the value of SSH_AUTH_SOCK to a different location on an OSX El Capitan system. I attempted to do so by executing the following command: $ launchctl setenv SSH_AUTH_SOCK ~/.gnupg/S.gpg-...
0
votes
1answer
61 views

launchd start times seem to be creeping later and later

I'm new to launchd, so it's possible I did something incorrectly. I have a script that I intend to run hourly. To that end, I created a plist file with the following entry in order to make that happen:...
0
votes
1answer
280 views

Trying to run Self Control block as a launchd daemon, get 'error 78' in Launch Control

I'm using Self Control to block distractions, and I'm trying to run it daily using the OSX launchd utility with the Launch Control GUI. This calls a script that figures out the amount of time to block ...
2
votes
0answers
702 views

Is it possible to run a launch agent as a user with sudo permissions?

I have an executable that needs to run every time a user logs in. It needs to run in the context of that user, but with root permissions, as if the user had run it with sudo. I have looked through ...
1
vote
6answers
10k views

Can't get launchd plist run successfully in Mac OS X

I’m using Mac OS X 10.10.5 (Yosemite) an learning to use launchd (Launch Daemon) to auto-run some scripts. To make it simple, I decide to use a shell script which only contains a echo command. ...
1
vote
1answer
154 views

Mac OS X El Capitain shutdown from the Apple menu doesn’t work but it works via shell

My problem is related to the shutdown. If I shutdown normally (Apple Icon -> Shut Down…) it doesn't work. Whereas it works via shell: sudo shutdown halt After many Googling, (guess what?) nothing ...
1
vote
1answer
254 views

launchd job not on list, but still running

I have a launchd job that is running every two minutes, but it is not on the sudo launchctl list. I was changing the plist file, both the name of the file, and the Label key. I didn't unload it ...
0
votes
1answer
685 views

LaunchAgent has undesired root access

I am having a problem getting my LaunchAgent to run as a normal (not-root) user. Everything I've read implies this should be the default behavior. The expectation is that if you put the plist in /...
-2
votes
1answer
140 views

How to run an SSH server on a laptop?

I want to create a program that allows a user to SSH into their laptop. But there is a serious problem: laptops sleep when they close. In particular, I believe this cannot be disabled on OS X. Does ...
3
votes
1answer
5k views

unable to load script via launchctl “command not found”

I have a problem loading a script to watch a folder via fswatch in /Library/LaunchAgents The script runs fine when run from terminal, but via my plist, it gives me "Command not found" for fswatch in ...
1
vote
1answer
46 views

LaunchDaemon to start server process doesn't work

I've tried to write this LaunchDaemon to start my server process. Seem like it should be simple, plutil lint says the file is "OK", but it doesn't launch. I've tried a number of variations and am ...
0
votes
1answer
1k views

Needing to open OS X bash script as via launchd IN a terminal window

I've got a lengthy and complex bash script which works OK, but I'm trying to automate my deployment process and I'm flummoxed at this point. I can get the script to run as a LaunchAgent no problem, ...
1
vote
0answers
104 views

mysqldump via launch daemon on mac osx not working

I'm trying to create a mysqldump of a database via bash script, and automate the process by using Mac's launchd / launchctl process. I can successfully run the bash script manually to backup the db in ...
2
votes
2answers
2k views

Setup sshd to start at boot on OSX El Capitan

I have a setup where I have an OSX machine as a server. OS is OSX El Capitan. One of the services it needs to have is sshd. The problem I am trying to solve is that when ever I reboot, I need to ...
1
vote
1answer
150 views

Error creating a Ruby launchd task with RVM in OS X

I want to periodically run a ruby gem based command. I am using RVM and following the tutorial set out here. My ruby task is called daily_checks.rb and is as follows: #!/usr/bin/env ruby puts 'in ...
6
votes
1answer
5k views

Why is diagnostics_agent “inherently inefficient” and what to do about it?

I have a clean install of 10.11. When I boot the system in my own admin account, with no login services enabled, nor any internet or cloud accounts enabled (e.g., Messages, Facetime, Mail, Calendar, ...
3
votes
2answers
2k views

launchd equivalent for Windows?

Using launchd on OS X, I can make commands/programs run at boot with launchctl in the CLI, so for example: launchctl submit -l someName touch /usr/local/someFile Would create someFile in /usr/local ...
1
vote
1answer
931 views

Launchctl - submit command instead of executable

I know it's possible to submit the path of a program to launchd via launchctl submit -l label [-p executable] [-o path] [-e path] -- command [args] But is it also possible to pass a command ...
7
votes
2answers
15k views

OS X: LaunchDaemon not running: Service could not initialize

I used Apple's seemingly straightforward docs to create a LaunchDaemon to run a Node.js script I wrote. Here's the plist file. It's basically exactly a copy-paste from Apple's docs, set to run every ...
2
votes
0answers
482 views

Start Appium server at system boot (MacOS)

I'm trying to setup Appium server to stat automatically after system startup. Also I'd like it to restart after a crash. Appium was installed as a npm package and it launches and works fine when I ...
7
votes
2answers
32k views

How to start a service using Mac OSX's launchctl

Why does my configuration plist file not load as a service using launchctl? I am running OSX Yosemite, and I have read this excellent tutorial on using launchctl http://nathangrigg.net/2012/07/...
1
vote
1answer
368 views

Starting Suricata with launchctl on Mac OS X

Using Mac OS X Yosemite 10.10.3. I'm trying to make Suricata start in daemon mode on boot with launchctl. Here is my /Library/LaunchDaemons/org.suricata.Suricata.plist: <?xml version="1.0" ...
0
votes
2answers
460 views

Unable to remove peruser launchd process

I am constantly getting the following messages in system log: com.apple.launchd.peruser.0 (homebrew.mxcl.memcached[PID]) Exited with code : 64 com.apple.launchd.peruser.0 (homebrew.mxcl.memcached) ...
2
votes
1answer
516 views

Running offlineimap via launchd doesn't survive sleep on OSX

I'm not very well versed in all things launchd but I wrote this plist file that periodically runs offlineimap to fetch new mail from IMAP servers: <?xml version="1.0" encoding="UTF-8"?> <!...
1
vote
0answers
96 views

Launchd process stalls Firefox startup on Mac OS Yosemite 10.10.2

I have long wait times up to 2 to 3 minutes when starting web browsers Firefox and Safari. Looked at Activity monitor and saw "launchd" taking up 98% of memory. CPU Time was 1.40.93 at the time. I ...