I have a standalone (3rd party) app that I'm trying to launch using a command "kick". I've setup my ~/.bash\_profile and /etc/bashrc files so that I can type kick [command] into a terminal window and it works perfectly. So I'm assuming that I have everything setup correctly.

The problem comes when I try and use NSTask.

Essentially what I'm doing is creating two mutable arrays, kickBuild and kickOut. One to assemble the command (it's a string of flags) and one to use with NSTask. I take kickBuild and convert it to a string separated by spaces, then add that as an object into the second array.

So my command should look something like **"kick -i /path/to/input/file.ext -as 2 -g 2.2"** etc. And if I type this into a terminal window it works great.

```
kickBuild = [[NSMutableArray alloc] initWithCapacity:100];
kickOut = [[NSMutableArray alloc] initWithCapacity:2]; // Thinking that this should be "kick" and then "-i /path/to/input/file.ext -as 2 -g 2.2"
kickPath = [kickLocationTextField stringValue]; // This is just the path to my kick executable. NOT /bin/sh. Is that correct?
NSString *tempKick = [kickBuild componentsJoinedByString: @" "];
[kickOut addObject:tempKick];
[NSTask launchedTaskWithLaunchPath:kickPath arguments:kickOut];

```

When I build my app and run this code, I get this error…

**dyld: Library not loaded: build/darwin\_x86\_64/gcc\_opt\_dynamic/core/libai.dylib**

**Referenced from: /Users/Gene/Kick/Kick-3.3.4.0/bin/kick**

**Reason: image not found**

This is an NSLog of kickOut…
kick -i /Users/Gene/Test\_Main.0001.ext -r 960 540 -as 2 -g 2.2 -v 5 -dp

Is this something that I'm doing wrong? Or is this an issue with kick?

How would I test NSTask with some basic terminal task to make sure that I'm using NSTask correctly?

```
kickBuild = [[NSMutableArray alloc] initWithCapacity:5];
kickOut = [[NSMutableArray alloc] initWithCapacity:2];
kickPath = @"/bin/sh";
[kickBuild addObject:@"-c"]; // Do I need this?
[kickBuild addObject:@"ls"];
[kickBuild addObject:@"~/Desktop"];
NSString *tempKick = [kickBuild componentsJoinedByString: @" "];
[kickOut addObject:tempKick];
[NSTask launchedTaskWithLaunchPath:kickPath arguments:kickOut];

```

If I run this without the @"-c", I get: **/bin/sh: ls ~/Desktop: No such file or directory**

Any help is appreciated.

Thanks a million