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
1answer
33 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 ...
0
votes
0answers
53 views

MacOS - Using script with launchd - startup, login, logoff, shutdown?

MacOS High Sierra I want to run this script on startup, login and shutdown, logoff. The script looks like this and is working successfully from terminal: #!/bin/sh find /private/my/tmp -mindepth 1 -...
0
votes
0answers
9 views

Limit launchd script to running when on AC power

I have a simple backup script setup as shown below. I would like to modify so that it only runs when on AC power. Is this something I can achieve with launchd settings, or perhaps I could have the ...
0
votes
0answers
7 views

How to perform an automatic and shell-scripted user-creation after a complete fresh install of macOS

I want to script the deployment of a new Mac. I want to disable Apples SetupAssistant and instead start a script, that creates a user. Using macOS 10.14+
0
votes
0answers
32 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 ...
0
votes
0answers
152 views

How to properly disable macOS daemons or agents?

When i use launchctl bootstrap ... and then launchctl bootout ... command, there are launched process after restarting system. What is going wrong? Does it properly to use launchctl disable ... or ...
0
votes
0answers
16 views

Simple Launchd file not working, permissions problems or something else?

I am trying to write a launchd file. I am using Mac OS X 10.13.3 I want it to write a file to a specific folder and add a line of text. I have a bash script: read-write-files.sh echo "Some text" &...
0
votes
0answers
18 views

MACOS: only few login elements in System Preferences

In MACOS, under System Preferences / Users / Login Elements there is a list of Login Elements that are started at the startup. Actually only few elements are listed here. There are many other ...
1
vote
0answers
31 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 ...
3
votes
1answer
274 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 ...
2
votes
2answers
538 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 ...
1
vote
1answer
1k 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 ...
1
vote
0answers
186 views

Mac OS High Sierra weekday scheduled tasks with launchd aren't working, why?

In an effort to improve my productivity and reduce distractions (after listening to 'Deep Work' by Cal Newport on Audible), I decided to automatically launch and close email and IM apps on my Mac at ...
1
vote
1answer
815 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 ...
0
votes
1answer
147 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 ...
1
vote
1answer
169 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 ...
0
votes
1answer
340 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 ...
2
votes
1answer
678 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....
1
vote
0answers
256 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 ...
1
vote
1answer
90 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 ...
0
votes
0answers
68 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 ...
0
votes
0answers
1k views

Launchd on OSX has high cpu usage

I am trying to find the cause of excessively high CPU and fan usage on my MacBook Pro. I have noticed this line in the console, this is repeated in the entire system.log. I don't know really what else ...
1
vote
0answers
154 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 ...
2
votes
0answers
442 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 ...
1
vote
0answers
162 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 ...
0
votes
1answer
45 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 ...
2
votes
1answer
374 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-...
0
votes
1answer
42 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:...
0
votes
1answer
233 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 ...
2
votes
0answers
475 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 ...
1
vote
3answers
5k 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. ...
1
vote
1answer
134 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 ...
0
votes
1answer
171 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 ...
0
votes
1answer
386 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 /...
-2
votes
1answer
126 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 ...
2
votes
1answer
3k 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 ...
1
vote
1answer
42 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 ...
0
votes
1answer
877 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, ...
1
vote
0answers
95 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 ...
2
votes
2answers
1k 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 ...
1
vote
1answer
136 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 ...
5
votes
1answer
3k 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, ...
3
votes
2answers
1k 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 ...
0
votes
1answer
633 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 ...
7
votes
2answers
12k 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 ...
2
votes
0answers
416 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 ...
5
votes
2answers
21k 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/...
1
vote
1answer
307 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" ...
0
votes
2answers
386 views

Unable to remove peruser launchd process

I am constantly getting the following messages in system log: com.apple.launchd.peruser.0 (homebrew.mxcl.memcached[PID]) Exited with code : 64 com.apple.launchd.peruser.0 (homebrew.mxcl.memcached) ...
1
vote
1answer
443 views

Running offlineimap via launchd doesn't survive sleep on OSX

I'm not very well versed in all things launchd but I wrote this plist file that periodically runs offlineimap to fetch new mail from IMAP servers: <?xml version="1.0" encoding="UTF-8"?> <!...