Questions tagged [launchd]
Launchd is a process management daemon, similar to "init". It is commonly used on Darwin-based systems.
631
questions
-1
votes
0
answers
37
views
git in plist: unable to read current working directory: operation not permitted
Mac M1 pro ventura13.2.1
Here's my plist ;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/...
0
votes
0
answers
27
views
Why Is my LaunchAgent not interacting with Time Machine Mac OSX
I am currently writing an automation script for mac that takes control of time machine to run the backup at night.
the script is wotking when running from a terminal, interaction as expected with time ...
0
votes
1
answer
13
views
Switching slack status automatically when connecting to specific wifi networks? (MacOs)
I found these instructions for automating Slack status based on the connected wi-fi. The post is quite old and it is not working for me on MacOS Ventura.
To be honest, I don't even know how to debug ...
-1
votes
0
answers
29
views
Can I execl/system launchctl from my launch daemon to start a launch agent?
I have a launch daemon and a launch agent. I want to run my launch agent as soon as the launch daemon starts up (without the need to restart macOS.)
I was thinking to do it with a call to (from my ...
0
votes
1
answer
55
views
How to start/stop my launch agent in all logged in sessions from a root user process?
I'm writing an installer for my launch daemon, and for a launch agent, that will run in every logged in user session on macOS. The installer will be running as an admin, and thus I can install and ...
-1
votes
1
answer
56
views
How to tell from a launch daemon if macOS is currently restarting?
I have a launch daemon (written in C++) that runs on macOS. Is there a way to tell if the operating system is currently restarting?
(Or the moment after the user hit Apple Logo -> Restart and the ...
2
votes
0
answers
36
views
macOS daemon displays GUI?
To learn about macOS services (daemons and agents), I have a sample GUI app which counts every 10 sec in the background and displays some UI.
In AppDelegate.swift
class AppDelegate: NSObject, ...
0
votes
0
answers
84
views
How to start a launch agent on demand after the installation?
I've coded my launch daemon and a launch agent for macOS. When the app is installed, I need to run both the daemon and the agent. I place the .plist for the deamon into /Library/LaunchDaemons and then ...
0
votes
1
answer
337
views
Issues starting MySQL server Mac
There are red dots, rather than green dots, next to "Active Instance" in the preference pane. Image here. When I click "Start MySQL Server" the lights flash green very briefly ...
0
votes
0
answers
25
views
How to schedule python task on macbook
I've been trying for few days to schedule a python script to run weekly even if my macbook is sleeping with launchd, but I'm struggling...
I keep getting "/Users/<myusername>/miniconda3/...
0
votes
0
answers
49
views
`Launchd` based logging - where does `log show` get its data from
I would like my logs to show up when I do something like this
log show --debug --info | grep "Myapp"
I am currently doing something like this in launchd which writes to a flat file.
<key&...
1
vote
1
answer
186
views
My personal launchagents have stopped working in MacOS Ventura. Any ideas?
I have a number of launch agents I've written over the years to automate some simple tasks, like rsyncing my music and photos from my laptop to my NAS. Recently I've noticed that they have stopped ...
0
votes
0
answers
41
views
Is there a way to authorize a script running through launchd to use the camera on MacOs
I wrote a script to take a picture with my webcam. I want it to run everytime I unlock my mac, so I created a com.example.selfie.plist file in ~/Library/LaunchAgents/. The sh script is working well ...
2
votes
1
answer
415
views
LaunchDaemon service on MacOS not running until user signs in
I have an app service I want to start at system startup with a plist file:
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&...
0
votes
1
answer
67
views
Launchd 'Invalid Property List'
I was hoping someone could point out where I might be going wrong with a launchctl script I'm trying to write and launch.
The intention is to run a python script I've managed to get working, everyday ...
0
votes
0
answers
379
views
Need help getting launch daemon working on macOS
I have a launch daemon that I just can't get to work. It's supposed to run a script every day at 3 AM. The script works and I can run it manually without sudo. See below for the launch daemon (com....
-1
votes
1
answer
112
views
How to keep a macOS Launch Agent open until the app that requested the service is closed?
Working on my first macOS Launch Agent using XPC.
I need the process that is delivering the service to be started by launchd and to then stay running until the client process that made the initial ...
0
votes
1
answer
156
views
What is the dot separation naming convention used for launchd jobs?
I'm following a tutorial to create a launchd job that runs a simple hello-world script.
The instructions require the creation of a plist file and suggest the following filename: com.demo.daemon.plist
...
2
votes
0
answers
282
views
Run Worker Service on Mac Os
I have created a Worker Service with .Net 6, I have published it via folder profile for Mac OS, Now in Windows I can create a service using SC CREATE, how do I achieve the same on Mac OS.
I have tried ...
2
votes
0
answers
58
views
Run launchd that runs a console app from Objective-C
I have an authentication app (authApp) that runs on Mac. AuthApp lets you log in to the Mac. It runs in place of the default login screen. I have added a new button in authApp and I want that button ...
0
votes
1
answer
35
views
macOS 12.4 - launchd service unable to access files in users directory [closed]
After upgrading to macOS 12.4 our Golang app which runs as a service on macOS is unable to read files in the user's home directory. Even when the file is readable for all the users. The service runs ...
0
votes
0
answers
57
views
Best practices for scheduling multiple jobs at different frequencies in a Python project?
I have started scheduling a couple scripts in Python using launchd. All my imports are from the root directory, though, so unless I want to mess with sys.path (which feels like poor practice) I need ...
0
votes
0
answers
69
views
Run multiple Python scripts in one Launchd .plist file
Is it possible to run more than one Python script in one Launchd .plist file?
I have the following, and it only runs the first script
<?xml version="1.0" encoding="UTF-8"?>
&...
1
vote
1
answer
161
views
Why does codesigned Go binary get tagged as “Unknown Developer” on macOS 13?
The current macOS 13 beta has a feature in which it displays all application-installed Login Items in a System Preferences panel, including LaunchDaemons. My app has a LaunchDaemon written in Go ...
0
votes
1
answer
279
views
Run python script automatically every 3 days with launchd (mac)
I am trying to automatically run a python script every 3 days.
What I am trying to accomplish is that the script is scheduled for every 3 days and if at that time the computer is offline, the job ...
1
vote
1
answer
236
views
Launchd plist cannot load
I am playing around with a very simple plist script which I want to execute at start-up and should create a simple text document after execution.
The file is as follows:
<?xml version="1.0&...
0
votes
1
answer
453
views
How to programmatically start an application at user login?
I am attempting to port a C# Windows application to macOS 12 Monterey for the first time. One of its features was setting up automatic start-up, which in there was done through Windows registry. I ...
0
votes
0
answers
84
views
Why doesn’t this bash script work when scheduled?
I have a bash script like so:
#!/bin/bash
cd /
pwd
ls
cd Users
pwd
ls
cd robl
pwd
ls
cd Documents
pwd
ls
When I run it manually via ~/bin/script.sh, it works as expected.
However, when I make a ....
0
votes
1
answer
216
views
macOS launchd fails to redirect stdout to the file after log rotation
I use launchd to configure a service to write logs to the file.
This is the launchd config.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//...
0
votes
1
answer
164
views
How do you run a PHP script every 1 minute using a plist file with launchd (launchctl) in MacOS?
So how do you run a PHP script once every 1 minute using a plist file with launchd (launchctl) in MacOS? This was a question I had that took forever to find the answer to, but I did eventually! I'm ...
0
votes
1
answer
135
views
launchd redirect stderr/out to timestamped log files?
I have a properties list to schedule a job with launchd to run every day. I can easily create a log file that redirects the std err/out to the location of my choosing as such
<key>...
3
votes
1
answer
367
views
Should macOS daemons be made from the "Command Line Tool" Xcode template?
I have a few questions regarding daemons. Indeed, even the macos developer center has limited information resources.
I want to develop an application daemon that runs after system boot without login.
...
0
votes
1
answer
837
views
Run batch script on startup macos - launchd
Im trying to add a LaunchDeamon on MacOS that is executed on startup.
I made a .sh script which works on direct execution. Its located at /usr/local/libexec/scripts/startup/
This is my script: startup....
2
votes
2
answers
894
views
Why does an Automator app get a permissions error when run as a LaunchDaemon?
I have Home Assistant Core (a Python server) running as a LaunchDaemon on an OSX 11.6 (Big Sur) Mac Mini. I am trying to build a plugin for it that directly accesses a camera attached to the machine. ...
0
votes
0
answers
236
views
Bootstrap failed: 5: Input/output error ( Python Script Automation on Mac)
I've been trying to automate this python script that goes to my college website and writes the latest notice into a textfile,via selenium. The script works successfully when executed mannually. I'm on ...
-1
votes
1
answer
1k
views
crontab job installing but not executing on my MAC
I have been trying to run a python script on my MAC every day automatically with no success so far. I failed using launched, and I am now trying to use crontab to see if I am luckier that way.
The ...
1
vote
1
answer
914
views
launchd error - Load failed: 109: Invalid property list - whilst trying to run python script -
I'm trying to use launchd for the first time, I wish to automate some scripts. When I try load my file I get the following error:
"Load failed: 109: Invalid property list"
Filename: com.test....
2
votes
2
answers
586
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 ...
0
votes
1
answer
39
views
script run by launchd not evaluating env variables
#!/bin/sh
SharePath=$(dscl /Search -read /Users/$USER OriginalHomeDirectory | awk '{ print $2 }' | sed -e 's/<[^>]*>//g'| awk -F'/' '{ print substr($0, index($0, $4))}')
prefix='/Volumes/'
...
0
votes
2
answers
369
views
Codesign fails during export using a launchd runner
When using fastlane to build and export an app all of our build machines have started failing to codesign during the export process. The only thing that has changed is the recent expiration of ...
1
vote
0
answers
221
views
Launch Job unable to execute bash script, receiving abnormal code 126
I am trying to get my launch job to execute a bash script. The bash script will get the current datetime and store it in a text file.
This is my current plist under the directory ~/Library/...
1
vote
2
answers
481
views
Launchctl service failed to initialize
I wrote the following plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/...
0
votes
0
answers
422
views
"No such file or directory" error when trying to load a .plist file
Hi there:
I am trying to load the following .plist file from my LaunchDaemons directory under my 'Library'. I want to execute my [executable file] every Sunday at 11:59PM.
When I type the following ...
0
votes
1
answer
215
views
Android builds fail when building with launchctl
I am trying to write a script to automate my build process and push builds every so often. So ever everything seems to be working except for my JAVA_HOME environment variable.
When building the app ...
0
votes
0
answers
87
views
Why does my zsh script works standalone but not when called by launchd?
I seeking help for to setup a periodical job on my imac with macOS Big Sur v11.4.
What I want to do, is to delete all contents of a given folder every 60 seconds with a bash or zsh script. It doesn't ...
0
votes
1
answer
70
views
Run remote backup on regulary base
I wrote a shell script which checks if a remote server is reachable.
If it is reachable, it runs via ssh a command at a different server.
After that, it does some rsync tasks.
Everything works well, ...
1
vote
1
answer
196
views
Mac launchDaemon service is launching my bash script repeatedly
I have been setting up a launch daemon that launch a bash script on demand. However, once I load my launch agent and communicate via socket, then it keep running my bash script every 10 seconds.I've ...
1
vote
0
answers
774
views
Apple Script "display notification" works within Script Editor, not from launchd
I started using launchd and encounter a peculiar issue. When I send a "display notification" it works fine from within Script Editor but not from launchd. The "say" command ...
0
votes
1
answer
166
views
Python script launched from launchd gives ImportError: No module named foo
When the python script iftttbot.py is run with launchd using iftttbot.plist (both included below) it gives the error:
Traceback (most recent call last):
File "/usr/bin/iftttbot.py", line 1,...
0
votes
1
answer
216
views
Triggering a notification from within a bash script
Target devices: macOS Catalina and higher
I could use some help fixing a problem in a script that is supposed to trigger an osascript notification whenever a user tries to connect to a banned SSID. ...