Register c# .netcore console application to start at system boot on macOs

Viewed 385

How can i programmatically in .net core, tell MacOS Catalina to startup my console application on system boot? I know that i can add program manually by Preferences:

Open System Preferences.
Go to Users & Groups.
Choose your nickname on the left.
Choose Login items tab.
Press “+” and choose the app you’d like add.
Then restart your Mac to see the changes.

But how to do this programmatically? Is this possible in .net core / zsh script?

1 Answers

You would need to add the plist for the application to the LaunchAgents folder for the user. The path on the mac is /Library/LaunchAgents.

If you wanted it to start up before the user logs in on the Mac you would add it to the LaunchDaemons folder found at: /Library/LaunchDaemons

Related