Where do we put an app after i pressed shutdown

I watched this youtube vid:https://www.youtube.com/watch?v=u78KDs_Ho7M

soo i saw them coded the app to run and played the sound, so i currently have my sound app and i dont know where to put this for it to run when i press shutdown on my mac, can i just coded in terminal?


Posted on Mar 6, 2025 08:18 AM

Reply
2 replies

Mar 31, 2025 10:47 AM in response to Doesappleallowit

There is no built-in mechanism for executing a script at shutdown.


Your option likely is going to need to approach this differently - namely have a background process start automatically and sit around idle, waiting for a TERM or KILL signal (indicating that the OS is shutting it down), then you can jump in with your sound before it quits.


Note that without some serious shenanigans (namely, writing your own Swift-based app), your script won't be able to tell the different between 'Shut down', 'Restart', or even 'Log out' - all of these would trigger the app to quit and it wouldn't necessarily know why.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Where do we put an app after i pressed shutdown

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.