Skip to content

Instantly share code, notes, and snippets.

@RxDx
Last active September 21, 2023 23:50
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save RxDx/0e6587e2adc2d2ac02e91e4e654227af to your computer and use it in GitHub Desktop.
Save RxDx/0e6587e2adc2d2ac02e91e4e654227af to your computer and use it in GitHub Desktop.
MacOS: Run script before shutdown
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