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
0 votes
0 answers
14 views

Why doesn't my LaunchD configuration successfully start gpg-agent?

I have the following in /Library/LaunchAgents/io.ell.gpg-agent.plist: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" ...
user avatar
  • 1,925
0 votes
0 answers
21 views

Prevent Plastic SCM `plasticd` from launching on startup macOS

I occasionally use Plastic SCM Cloud Edition to do version control and I noticed that the process plasticd will automatically get launched on startup. How can I prevent it from always starting up with ...
user avatar
  • 213
0 votes
0 answers
19 views

Why does this Launchd service load but does not run?

I am using Code-Server by Coder on Github to host a web VS-Code Session. I have decided to use launchd to Auto Start the server. I am Trying to make a Setup where you have to connect to a proxy server ...
user avatar
0 votes
1 answer
485 views

How to schedule a script to run automatically even if Mac is sleeping?

I'm really struggling with this. Basically I want to run a Python script every 3 hours on my Mac. Even if I'm not using the Mac. So even if the Mac is asleep I want it to wake up and run the script. ...
user avatar
1 vote
1 answer
152 views

launchd unable to access external drive

I'm trying to automate a script to backup a couple of directories on my Mac mini (macOS 11.4). Some of the files I want to backup are stored on an external drive that is mounted to /Volumes/SHASTA. I ...
user avatar
1 vote
1 answer
221 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 ...
user avatar
0 votes
0 answers
768 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 ...
user avatar
  • 1
0 votes
0 answers
179 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/...
user avatar
  • 101
0 votes
1 answer
398 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 ...
user avatar
1 vote
0 answers
20 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 ...
user avatar
0 votes
1 answer
137 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 ...
user avatar
0 votes
0 answers
153 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 ...
user avatar
1 vote
0 answers
60 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 ...
user avatar
  • 249
3 votes
1 answer
917 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 ...
user avatar
2 votes
2 answers
904 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 ...
user avatar
1 vote
1 answer
4k 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 ...
user avatar
1 vote
1 answer
2k 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 ...
user avatar
  • 121
0 votes
1 answer
229 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 ...
user avatar
1 vote
1 answer
260 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 ...
user avatar
0 votes
1 answer
431 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 ...
user avatar
2 votes
1 answer
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....
user avatar
  • 1,300
1 vote
0 answers
404 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 ...
user avatar
  • 33
1 vote
1 answer
118 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 ...
user avatar
  • 139
0 votes
0 answers
82 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 ...
user avatar
  • 123
1 vote
0 answers
189 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 ...
user avatar
2 votes
0 answers
552 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 ...
user avatar
  • 328
1 vote
0 answers
239 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 ...
user avatar
  • 111
0 votes
1 answer
277 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 ...
user avatar
  • 1
2 votes
1 answer
898 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-...
user avatar
0 votes
1 answer
75 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:...
user avatar
0 votes
1 answer
308 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 ...
user avatar
2 votes
0 answers
858 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 ...
user avatar
1 vote
6 answers
12k 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. ...
user avatar
  • 123
1 vote
1 answer
160 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 ...
user avatar
  • 11
1 vote
1 answer
342 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 ...
user avatar
  • 167
0 votes
1 answer
870 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 /...
user avatar
-2 votes
1 answer
146 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 ...
user avatar
3 votes
1 answer
6k 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 ...
user avatar
  • 153
1 vote
1 answer
49 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 ...
user avatar
  • 21
0 votes
1 answer
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, ...
user avatar
1 vote
0 answers
112 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 ...
user avatar
  • 237
3 votes
2 answers
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 ...
user avatar
  • 141
1 vote
1 answer
157 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 ...
user avatar
  • 111
7 votes
1 answer
6k 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, ...
user avatar
3 votes
2 answers
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 ...
user avatar
1 vote
1 answer
1k 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 ...
user avatar
7 votes
2 answers
16k 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 ...
user avatar
3 votes
0 answers
521 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 ...
user avatar
  • 31
9 votes
2 answers
37k 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/...
user avatar
  • 211
1 vote
1 answer
466 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" ...
user avatar
  • 1,978