650 questions
0
votes
0
answers
21
views
MacOS Launch Daemons
I am trying to create a Launch Daemon that launches whenever I log in. I know that launch agents are better suited for this job, but I want to accomplish it with a launch daemon instead because It's ...
0
votes
0
answers
131
views
When starting a launch agent using SMAppService, how do you force it to update the full path of the agent?
I'm creating a launch agent using the following method:
@implementation AppDelegate {
SMAppService *agentService;
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
...
0
votes
0
answers
58
views
Personal LaunchAgent no longer works correctly in MacOS 15.x - appears to be due to iCloud desktop?
I have a launchagent that I've been using for well over 10 years. Once a week it cleans up my desktop, moving any files it finds to a "Desktop_Archive" folder.
Unfortunately, while the ...
1
vote
1
answer
104
views
debugging a MacOS launchd script
I have run out of things to look for or don't know where to look anymore.
I have a perl script that checks a particular website to see if it has changed, and throws an alert one way or another. ...
0
votes
1
answer
125
views
chmod Command Fails with Exit Code 1 When Run from LaunchDaemon on macOS
I am facing an issue with a bash script run by a LaunchDaemon on macOS, which is supposed to change the permissions of the Google Chrome application at specific times. The script runs correctly when ...
1
vote
0
answers
56
views
MacOS + launchd + python + mariadb = server connection fail
I am new to this group. Hopefully someone can provide some guidance to solve my issue... I am attempting to schedule the running of my python program on my Mac using launchd.
I have hit a roadblock ...
0
votes
1
answer
66
views
Why can't my launchdaemon find the bash commands?
I'm writing a bash script that enables and disables sleeping on my MacBook based on whether my headphones are connected by bluetooth or not, so I can close the lid and listen to music without the ...
2
votes
0
answers
60
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
109
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
387
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 ...
-1
votes
1
answer
57
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
66
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
...
1
vote
1
answer
3k
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
232
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
249
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
314
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
182
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
660
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
166
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
102
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
562
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
231
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
294
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
163
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
71
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
153
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 ...
2
votes
1
answer
2k
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
171
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
174
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
2k
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 ...
1
vote
1
answer
2k
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
287
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
2k
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
278
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
3k
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
475
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 ...
1
vote
1
answer
498
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
770
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
151
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
167
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
174
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
654
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
461
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
1k
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&...
2
votes
1
answer
2k
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
137
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
825
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
363
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 ...