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.

I'm trying to use a launchagent on login to kill the Finder, and then re-launch TotalFinder, to automatically apply the colorsidebar mod for OS X 10.7 (the mod can be found here).

If I use the launchagent to call a shell script, it's fine, like so:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.colorsidebar.root</string>
    <key>KeepAlive</key>
    <false/>
    <key>RunAtLoad</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
        <string>/POSIX/path/to/some/shell/script.sh</string>
    </array>
</dict>
</plist>

And then in the shell script, all I use is

#!/bin/bash
#
#This file kills the finder on user session start
#and re-launches TotalFinder
#

killall Finder
Open /Applications/TotalFinder.app

Now, when I try to combine the two like so

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.colorsidebar.root</string>
    <key>KeepAlive</key>
    <false/>
    <key>RunAtLoad</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
        <string>/bin/bash</string>
        <string>killall Finder</string>
        <string>open /Applications/TotalFinder.app</string>
    </array>
</dict>
</plist>

It doesn't work, and console shows the following error:

8/21/11 5:16:16.957 PM com.colorsidebar.root: /bin/bash: killall Finder: No such file or directory

share|improve this question

1 Answer 1

bash expects to be given an filename (i.e. a script) as its argument. Since there's no file named "killall Finder", you get an error to that effect. If you want to pass commands to bash as arguments, you must use the -c option, and pass the commands as a single argument:

<key>ProgramArguments</key>
<array>
    <string>/bin/bash</string>
    <string>-c</string>
    <string>killall Finder; open /Applications/TotalFinder.app</string>
</array>
share|improve this answer

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.