Last active
May 17, 2023 22:41
-
-
Save talkingmoose/1215744 to your computer and use it in GitHub Desktop.
Example: How to launch a GUI application using launchd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>KeepAlive</key> | |
<true/> | |
<key>Label</key> | |
<string>pvt.talkingmoose.LaunchTextEdit</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/bin/open</string> | |
<string>-a</string> | |
<string>/System/Applications/TextEdit.app</string> | |
</array> | |
<key>RunAtLoad</key> | |
<true/> | |
</dict> | |
</plist> |
It is not opening for me. I tried teh same steps.
@rvarkey, this launch agent plist was written more than 10 years ago. If you’re running it on a Monterey Mac, the path to TextEdit has changed to /System/Applications/TextEdit.app
. Other than that, it still works in my testing.
I’ve updated it and included an additional key to keep it running. You can remove the KeepAlive key and value if all you want to do is launch at login.
Also, be sure ownership and permissions on the plist are set to root:wheel 644 after you’ve deployed it.
Thanks @talkingmoose changing the path and setting the permissions helped.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Paste the above code into a TextEdit window and save it as plain text. Save the file as pvt.talkingmoose.LaunchTextEdit.plist into /Library/LaunchAgents. Log out and log in. TextEdit should open automatically for any user.