647
questions
1
vote
0
answers
42
views
LaunchD spawning two instances of LaunchAgent
I have this application that is divided in 3 parts.
A server that handles all the networking code
A agent that handles all System related code
A manager (NSApplication) to interact with the other two ...
0
votes
0
answers
12
views
Worker Permission Message on Mac
I created a worker project with C# with .Net Core 7.0 to run on macOs environments as bacground service. I launch this project with plist. Later, when I open any application, I encounter the following ...
0
votes
0
answers
56
views
Launchd operation not permitted on mounted drives
I am trying to implement a script to perform rsync between two mounted drives on my MacOS (Monterey v12.7.3).
Before performing the sync, I try to cleanup old files using a find and delete command. ...
0
votes
0
answers
54
views
MacOS App: How do we launch bundled helper program from main application?
I would like to achieve simple thing but struggling for the whole day. :(
I made a simple macOS app. In AppDelegate, applicationDidFinishLaunching, I would like to execute a helper program which is ...
0
votes
0
answers
138
views
Mac LaunchAgent with full disk access and caffeinate
I have a script that I would like to run every day at 4 AM. It downloads data to my user folder, fits some models, and saves files within my user directory. The script is a shell script, with one ...
0
votes
0
answers
39
views
MAC os service for usb insertion and removal
i am trying to create a service for mac that triggers a python file whenever a usb is inserted or ejected in the system. My code works for this functionality but when i shut down my pc and restart the ...
0
votes
0
answers
33
views
2. Bash script runs from Terminal but not from launchd
The script sorts the download folder into folders with date.
#!/bin/bash
eDate=$(date +%s) #Epochal date
cDate=$(date +%Y-%m-%d) ...
0
votes
1
answer
49
views
Running Typescript from Launchd
Updated; I found the path to npx using type npx
I would like to run a TypeScript script from a launchd.
I'm successfully running the script directly using /usr/local/bin/npx ts-node /path/to/script.ts
...
0
votes
0
answers
40
views
Launch Agent unable to delete file and folder inside $HOME/Library/Containers/{yourAppFolder} macOS 14
In macOS 14 launch agent is unable to delete files and folders inside $HOME/Library/Containers/{yourAppFolder}
In older macOS (less than 14) launch agent able to uninstall the app container
I know ...
0
votes
1
answer
1k
views
How do I start the ssh-agent at boot (or login) using Launchd?
There's a plist in /System/Library/LaunchAgents/com.openssh.ssh-agent.plist. I've spent a couple hours trying to get it to start at boot/login, but I have had no luck yet. Most of my time has been ...
0
votes
0
answers
204
views
How to set up automatic script launch on MacOS?
I'm not a programmer, so I went to solve my problem in ChatGPT. The task is this: create a script that will automatically create a screenshot of the entire screen on MacOS every 2 minutes, save them ...
1
vote
0
answers
160
views
XPC service and mac application do not connect to each other
I am currently writing an agent for endpoint security. I cannot connect the application and the xpc service. I start the plist with launchctl and then open the application, but it does not connect and ...
-1
votes
1
answer
200
views
macOS: launchD won't run script if screen is locked
first and foremost: I'm new to macOS scripting and rely heavily on the internet to get things done. I searched for a while but couldn't find a solution, so I'm asking here. Please tell me if this isn'...
0
votes
1
answer
150
views
MacOS Launchd move files plist in Ventura not working
I am trying to schedule two zsh commands every 10 seconds
The plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" &...
0
votes
2
answers
385
views
launchd plist for rsync backup
I have an rsync2server script that works to completion when run from zsh.
Now I'm trying to make it run at night when my MacBook Air m2 2023 Ventura is sleeping.
First I created a plist to execute the ...
1
vote
0
answers
112
views
In Swift on macOS, how can I properly catch the powerdown event from NotificationCenter?
I know this has asked before, but I have not yet found an answer that has actually helped me.
What I'm trying to do is write a launchd daemon in Swift, that will catch the shutdown notification and ...
0
votes
1
answer
82
views
should we use .app bundle or the unix exe of the GUI app for launching as an Agent
I wanted to launch a GUI Application as a User Agent in Macos, but I m not sure about the right way of doing it. I m aware of 2 ways and wanted to know which should be used and why?
Using the Unix ...
-1
votes
1
answer
341
views
How to run system service before login in macOS 12.5.1? [duplicate]
I put the plist file in /Library/LaunchDaemons directory, chown to root and run sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist to enable and load it.
zyl@imac:~% ls -l /...
1
vote
0
answers
193
views
Jenkins swarm agent unable to build chain to self-signed root for signer "Apple Development: Local (123456789)"
I am using the Jenkins Swarm Plug-in v.3.24 to run my 2020 M1 mac mini with macOS Ventura 13.3.1 as a Jenkins agent. The goal is to use Jenkins to schedule and execute iOS build scripts on that mac. ...
0
votes
0
answers
204
views
Running a startup shell script on macOS as a specific user
On macOS I have several servers set up to run via a user account called "server". From my main user account, I can start them manually with the following commands, one after the other, and ...
0
votes
0
answers
98
views
How to tell programmatically if my launch daemon is currently running on macOS?
From an app written in C++, how can I tell that my launch daemon is currently running? And preferably how to get its PID?
For instance, if I run the following in the terminal:
launchctl list com....
0
votes
0
answers
50
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 ...
1
vote
1
answer
120
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
vote
1
answer
1k
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
2
answers
139
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 ...
1
vote
0
answers
117
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
1k
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
4k
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
1
answer
739
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&...
3
votes
1
answer
1k
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
223
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
1k
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
200
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 ...
1
vote
1
answer
2k
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....
0
votes
1
answer
365
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
361
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
655
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
134
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
123
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
149
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 ...
1
vote
1
answer
541
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
425
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
858
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
1k
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
122
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 ....
1
vote
3
answers
520
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
315
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
405
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>...
4
votes
1
answer
1k
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
3k
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....