Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4005584
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:24:41+00:00 2026-05-20T08:24:41+00:00

I have a standalone (3rd party) app that I’m trying to launch using a

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T08:24:42+00:00Added an answer on May 20, 2026 at 8:24 am

    Here’s a simple NSTask test that should work for you (note: arguments:(NSArray *)arguments):

    /*
    
    gcc -Wall -O3 -x objective-c -fobjc-exceptions -framework Foundation -o nstask nstask.m
    
    ./nstask
    
    http://stackoverflow.com/questions/5081846/trying-to-run-nstask-but-getting-an-error
    
    
    launchedTaskWithLaunchPath:arguments:
    
    Creates and launches a task with a specified executable and arguments.
    
    + (NSTask *)launchedTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments
    
    
    */
    
    #import <Foundation/Foundation.h>
    
    int main(int argc, const char *argv[])
    {
    
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    
    NSTask *task = [NSTask new];
    
    NSMutableArray *kickBuild = [[NSMutableArray alloc] initWithCapacity:5];
    //NSMutableArray *kickOut = [[NSMutableArray alloc] initWithCapacity:2];
    NSString *kickPath = @"/bin/ls";
    
    //[kickBuild addObject:@"/bin/ls"]; // Do I need this?
    [kickBuild addObject: [@"~/Desktop" stringByExpandingTildeInPath]];
    
    task = [NSTask launchedTaskWithLaunchPath: kickPath arguments: kickBuild];
    [task waitUntilExit];
    
    
    [pool release];
    
    return 0;
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a standalone Java app that has some licensing code that I want
I have a class that unmarshals xml from a 3rd party source (I have
Does MSTest have standalone GUI similar to nUnit that lets me use it and
We have some standalone devices that will send XML messages to arbitrary processing software
I have an exe that has been wrapped using this method: http://www.kocjan.org/tclmentor/10-tclkits-building-standalone-tcl-binaries.html Is there
I have a standalone enum type defined, something like this: package my.pkg.types; public enum
I have stfw but I cannot find a simple / standalone way to create
I have a problem that I feel is best implimented in a stand alone
Have just started using Google Chrome , and noticed in parts of our site,
Have just started using Visual Studio Professional's built-in unit testing features, which as I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.