Need help with getting a login script to work with a login hook.
I have tried three methods to implement a login script on OS X 10.6.8 Snow Leopard. I am trying to get the third method to work because, if I understand correctly, it runs in the background without anything appearing on the screen.
The first method involves an AppleScript saved as an application that is added to the list of login items via System Preferences in the Accounts pane. When the account is logged in, an AppleScript icon briefly appears and disappears on the Dock.
The second method involves a Terminal shell script that is saved with the name “login.command”, made executable via the Terminal command line, and then is added to the list of login items via System Preferences in the Accounts pane. Using this method, when the account is logged in, a Terminal window opens.
The third method involves a login hook. It does not seem to work, although a similarly configured logout hook does work. This method uses a Terminal shell script also. The shell script is saved with the name “loginscript” in the folder at the location “/usr/local/bin”, and the script is made executable via the Terminal command line. Then, the below commands are run on the Terminal command line:
sudo defaults write com.apple.loginwindow LoginHook /usr/local/bin/loginscript
sudo defaults read com.apple.loginwindow
Might anyone know how to make the third method work? I can provide more details of what I have done, if necessary.