There is an excellent open source (Apache-licensed) tool called Outset that will run scripts for Mac computers once at boot, every boot, once at login, every login, or on demand. You can add and remove ignored users (users you don’t want to run those scripts for). And all you have to do, once Outset is installed, is drop the scripts into the appropriate folders (e.g., /usr/local/outset/boot-every) and make sure they have the right ownership and permissions.
I’ve been working with chilcote (the original developer of Outset) to see if it made sense to bring logout scripts into Outset. After much discussion and testing, chilcote ultimately decided it was outside the scope of what he wanted for Outset, but he encouraged me to make a spinoff called Offset.
After a lot of tweaking and testing and re-testing, I have a first working version (would still love testers!) of Offset, which will run scripts at logout.
Once Offset is installed, just put your scripts into /usr/local/offset/logout-every and make sure they have the correct ownership (root:wheel) and permissions (755 for scripts, 644 for packages).
Check out the README file for lots more detailed information, including why I ultimately went with the login window launch agent instead of two other methods (login launch agent that runs scripts when interrupted or logout hook).
Leave a Reply