Skip to main content

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
2 answers
757 views

Why does this LaunchAgent plist not run at all?

I have the following plist file as ~/Library/LaunchAgents/wealthychef.obsidian-daily.plist. I'm wondering why it does not execute when loaded. I feel like it should run every minute from 18:00 to 18:...
Rich's user avatar
  • 245
0 votes
1 answer
34 views

Use atrun via launchD on MacOS

I'm trying to schedule a job using the at-command in a script invoked by a launchDeamon. This doesn't seem to work. The launchD for atrun is running. Atrun, cron and terminal all have full disk access....
meatballbeam's user avatar
1 vote
0 answers
258 views

"Allow in the Background" Login items OS X Ventura Issue (NOT Notifications related)

Mac OS 13.3.1 I have a relatively simple shell script as a program argument in a LauchAgent plist that i created; it parses, loads and works just fine. The question is, what does toggling the ...
Jr M's user avatar
  • 21
1 vote
1 answer
375 views

Can a macOS launch agent be run as a user that is not the 'active' user?

I have multiple users on a single iMac. They stay logged on, but put the display to sleep via a hot corner when finished. After a short time, a password is required and this allows them to switch ...
Crashmeister's user avatar
3 votes
1 answer
4k 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. ...
kitchen800's user avatar
1 vote
1 answer
736 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 ...
RadicalRiemann's user avatar
1 vote
2 answers
3k 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 ...
andrelmsantos's user avatar
0 votes
0 answers
427 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/...
Siraj's user avatar
  • 101
0 votes
1 answer
871 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 ...
Chrisatx's user avatar
1 vote
0 answers
28 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 ...
Tom Widerøe's user avatar
0 votes
1 answer
370 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 ...
Duke of CitizenKanedom's user avatar
0 votes
0 answers
339 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 ...
Phoxxent's user avatar
1 vote
0 answers
162 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 ...
maxedison's user avatar
  • 249
3 votes
1 answer
2k 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 ...
Nestarion's user avatar
2 votes
2 answers
1k 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 ...
Nutritioustim's user avatar
1 vote
2 answers
5k 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 ...
Ricki Runge's 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 ...
JMikes's user avatar
  • 121
0 votes
1 answer
285 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 ...
stubert's user avatar
1 vote
1 answer
403 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 ...
philosopher's user avatar
0 votes
1 answer
604 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 ...
philosopher's user avatar
2 votes
1 answer
2k 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....
jameshfisher's user avatar
  • 1,492
1 vote
0 answers
564 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 ...
krees's user avatar
  • 33
1 vote
1 answer
144 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 ...
Pei's user avatar
  • 139
0 votes
0 answers
150 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 ...
anon01's user avatar
  • 123
1 vote
0 answers
273 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 ...
SkrewEverything's user avatar
2 votes
0 answers
897 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 ...
freedev's user avatar
  • 328
1 vote
0 answers
378 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 ...
PaulCo's user avatar
  • 111
0 votes
1 answer
747 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 ...
Tycho's user avatar
  • 1
2 votes
1 answer
2k 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-...
Sora Minazuki's user avatar
0 votes
1 answer
132 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:...
Victor Engel's user avatar
0 votes
1 answer
366 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 ...
crass_sandwich's user avatar
3 votes
1 answer
2k 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 ...
Chris Vasselli's user avatar
1 vote
6 answers
18k 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. ...
jinglei's user avatar
  • 123
1 vote
1 answer
169 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 ...
Valerio's user avatar
  • 11
1 vote
1 answer
544 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 ...
dmgig's user avatar
  • 177
0 votes
1 answer
1k 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 /...
user1169420's user avatar
-2 votes
1 answer
170 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 ...
William Rosenbloom's user avatar
4 votes
1 answer
7k 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 ...
jan's user avatar
  • 209
1 vote
1 answer
120 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 ...
Ben S.'s 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, ...
realdannys's user avatar
1 vote
0 answers
120 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 ...
mheavers's user avatar
  • 237
3 votes
2 answers
3k 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 ...
kpaleniu's user avatar
  • 141
1 vote
1 answer
186 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 ...
Obromios's user avatar
  • 111
7 votes
1 answer
7k 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, ...
grad student's user avatar
3 votes
2 answers
3k 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 ...
Zocker3333's user avatar
2 votes
1 answer
2k 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 ...
Zocker3333's user avatar
7 votes
2 answers
17k 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 ...
nickcoxdotme's user avatar
3 votes
0 answers
701 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 ...
al0's user avatar
  • 31
12 votes
2 answers
52k 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/...
almel's user avatar
  • 241
1 vote
1 answer
674 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" ...
drew1kun's user avatar
  • 2,187