There are three standard ways to run at login:
You can implement a pre-login launchd agent, which runs asynchronously with respect to login.
You can implement an authorisation plug-in, which is run synchronously during the login process.
As a specific case of the previous, your authorisation plug-in can use the
SFAuthorizationPluginViewclass to customise the login UI.
Each of these is a complex topic in its own right. A good place to start is Technote 2228 Running At Login, which covers a bunch of the basics.
IMPORTANT That technote is almost 10 years old now, so it has a bunch of broken links and some of the low-level details have changed. However, the overall architecture described by the technote is still valid. If you hit something you don’t understand, just post your follow-up questions here.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"