Skip to content

Instantly share code, notes, and snippets.

@RxDx
Last active July 18, 2024 02:23
Show Gist options
  • 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