Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My question is fairly straight forward: can you have more than one LoginHook or more than one LogoutHook?

I've done my own research and it looks like every time you add a new LoginHook, the previous one goes away. I think I can confirm this by running the old:

sudo defaults write com.apple.loginwindow LoginHook /path/to/script

Then checking to see that the loginhook is registered in the /var/root/Library/Preferences/com.apple.loginwindow.plist, then repeat the process by adding another loginhook, looking at the root loginwindow plist to see that the second script was over written by the first. There is never more than one.

Is that correct? Are you ever only able to have one LoginHook?

share|improve this question
    
In programming terms, LoginHook is the key to an array element, /path/to/script its value. You don't add new values, but set, overwriting the existing one. –  Daniel Beck Jan 11 '12 at 21:18

1 Answer 1

up vote 3 down vote accepted

This is not possible. Quoting here:

There is only one login hook, which means that it's not suitable for shrink wrap developers because you can't be guaranteed that the user hasn't already installed some other software that's using it. In general, you should consider the login hook to be reserved for use by site administrators.

The linked article mentions multiple alternatives. A Launch Agent might work for login, depending on your specific requirements.


There is no alternative to logout hooks. Quoting the same article:

Specifically, while the authorization plug-in technique described in this technote is a good alternative for the login hook, there is currently no equivalent replacement for the logout hook.

See also this unanswered question.

share|improve this answer
    
Thanks Daniel! That was a very helpful response. –  user976980 Jan 18 '12 at 16:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.