You can boot into single user mode by holding Command + s at startup.
Single user mode starts you directly at the console, bypassing core Mac OS X startup processes. You should be able to remove or alter the offending file from there.
The Program
key specifies the file to execute, & the ProgramArguments
key specifies the arguments which will be passed to the executing process. Strictly speaking you can pass whatever arguments you want to a process, but the convention is that the first one should be the name by which the process was invoked, so most programs ignore their first argument.‡ The file to execute is obviously necessary information, but if the Program
key is is missing, launchd pretends it has the same value as the first argument in ProgramArguments
purely as a convenience.
Your first example starts boinccmd & gives it arguments that would be equivalent to the terminal command
--host\ localhost --passwd\ gobbledygook --project\ http://setiathome.berkeley.edu/\ update
which tells boinccmd that you invoked it as "--host localhost" & only passed it two weird arguments.
Your second example separates the arguments correctly, but as Eddie Kelley suggested it needs one inserted at the front. It tells boinccmd that you invoked it as "--host", then passed another six arguments. boinccmd can recognise the last five as being two options, but has no idea what the "localhost" business is about. As far as boinccmd can tell, it was invoked from the terminal as
/Library/Application\ Support/BOINC\ Data/boinccmd localhost --passwd gobbledygook --project http://setiathome.berkeley.edu/ update
(note the missing "--host").
boinccmd is probably one of the great majority of programs that don't care what their first argument is, so you could probably actually just shove <string>HELLO</string>
at the head of the ProgramArguments
array, but it's probably cleaner to remove the Program
key altogether & just use this:
<key>ProgramArguments</key>
<array>
<string>/Library/Application Support/BOINC Data/boinccmd</string>
<string>--host</string>
<string>localhost</string>
<string>--passwd</string>
<string>gobbledygook</string>
<string>--project</string>
<string>http://setiathome.berkeley.edu/</string>
<string>update</string>
</array>
‡ It can seem like a meaningless redundancy, but some programs use this to good effect: bash et al. act as login shells if their first argument begins with -
, & Vim enters various emulation modes if its first argument is ed
or vi
instead of vim
.
Best Answer
I struggled a lot with Matthieu's solution since it caused two problems on my Mac OS X 10.9.2:
LaunchAgents
folder are executed using the current user. Howeverarp
needs to be executed usingroot
.arp
-command is executed too early, when the network is not up. But the network is needed by thearp
-command.The first problem can be solved by storing the
.plist
file inLaunchDaemons
instead ofLaunchAgents
. This will ensure that the command is executed as root.The second problem is a bit tricky. Since
launchd
does not handle dependencies, we have to write our own shell script which first waits until the network is up an then execute thearp
command. (See here)So here is my solution:
First create/open the plist file using a text-editor:
Then paste the following content:
Set owner etc.:
Now create/open the shell script using a text editor
Paste the following:
And the rights: