-
-
Save kmatt/28b5834a4a0ae7256a8aae575b5c0e07 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: | |
$ vim /Users/Shared/logoutHook.sh | |
File content: | |
#!/bin/bash | |
say 'Hasta la vista baby!' | |
Set execution 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