Skip to content

Newsletter · Issue #059

launchctl submit Kept the App Alive

After this issue, the reader can tell whether an app that reopens after quit is being relaunched by a leftover launchctl submit KeepAlive job, and can unload that job instead of rewriting the app.

Published
Format
Teardown
Reader job
Explain
Length
2 min read
Written by
Victor Solano

A local macOS app came back as soon as I quit it. The binary was not the cause. Two leftover jobs from earlier repair sessions were still registered with launchd: com.victor.conduit.focus-restart.20260817 and com.victor.conduit.clipboard-install. Both had been created with launchctl submit. Apple's man page says that mechanism also tells launchd to keep the program alive in the event of failure.

Print the label, run count, and properties if the job exists. After the two leftovers were unloaded, this command answered that it could not find either service.
launchctl print gui/$(id -u)/<label>

The first leftover script slept eight seconds, quit the app, then opened it again. Because launchd treated the job as KeepAlive, that sequence kept repeating. A quit that lasted about half a second was the red proof. Their recorded run counts were 8,429 and 9,169. After both labels were unloaded, the same quit left the app absent for twenty seconds of half-second samples. The app source was not changed.

The check

Before you rewrite an app that will not stay quit, print the launchd labels that mention it. Unload the leftover KeepAlive job, watch the quit again, and remove the one-shot submit helper in the same pass.

Print the job before you rewrite the app.