On 2023-05-10, Benjamin Esham <usenet@esham.io> wrote:
Dr Stephen Strange wrote:
I am running the CumuusMX weather program on an Mac Mini.
[snip]
To make it start on boot I have wriiten a very small bash script
cd /Users/username/CumulusMXD
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono CumulusMX.exe >>>
Then I have used Automatator as here
https://stackoverflow.com/questions/6442364/running-script-upon-login-in-mac-os-x/6445525#6445525
And added the result to login items.
This works but is there a better way?
The "Right Way" to do this kind of thing on a Mac is to use launchd, which >> is the Mac equivalent of systemd. (Or at least the "launch programs under
certain conditions" part of systemd.) That Stack Overflow answer actually
points to this solution when it says, "the cleanest way to run any program >> or shell script at login time is described in @trisweb's answer". The answer >> in question is at [1], and IMO it gives a reasonable summary of what you
need to do to launch your program through launchd.
If you find yourself dealing with launchd more than occasionally, I highly >> recommend using LaunchControl [2], which is a GUI that shows all of the
launchd agents and daemons you have running and allows you to modify them, >> with more guardrails and sanity checking than you'd have if you were just
editing the XML files by hand.
Hope this helps!
Benjamin
[1] https://stackoverflow.com/a/13372744/371228
[2] https://soma-zone.com/LaunchControl/
This is the correct answer. And I also recommend using a GUI utility to
do it if you are unfamiliar with launchd (and even if you are).
I've used another GUI launchd utility called Lingon [3] for years. I
wonder how it compares to LaunchControl.
[3] https://www.peterborgapps.com/lingon/
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 482 |
Nodes: | 16 (3 / 13) |
Uptime: | 36:55:29 |
Calls: | 9,550 |
Calls today: | 10 |
Files: | 13,656 |
Messages: | 6,141,462 |