Last active
July 18, 2024 02:23
-
-
Save RxDx/0e6587e2adc2d2ac02e91e4e654227af to your computer and use it in GitHub Desktop.
MacOS: Run script before shutdown
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
Create a file: | |
$ pico /Users/Shared/logoutHook.sh | |
File content: | |
#!/bin/bash | |
say 'Hasta la vista baby!' | |
Set exuction permission: | |
$ sudo chmod +x /Users/Shared/logoutHook.sh | |
Script hook: | |
$ sudo defaults write com.apple.loginwindow LogoutHook /Users/Shared/logoutHook.sh | |
To remove the hook: | |
$ sudo defaults delete com.apple.loginwindow LogoutHook |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment