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 8064491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:22:57+00:00 2026-06-05T11:22:57+00:00

So im trying to run some basic terminal commands in my mac app and

  • 0

So im trying to run some basic terminal commands in my mac app and for some reason(s) I just can’t to it.

Heres my code:

NSString *commitText = [commitMessage stringValue];
NSString *a = [NSString stringWithFormat:@"cd %@", dirPath];
NSString *c = [NSString stringWithFormat:@"usr/bin/git commit -m '%@'", commitText];

NSTask *aTask = [[NSTask alloc] init];
NSMutableArray *args = [NSMutableArray array];
[args addObject:@"-c"];
[args addObject:a];
[args addObject:@"git add *"];
[args addObject:c];
[args addObject:@"git push origin HEAD"];

NSPipe *pipe;
pipe = [NSPipe pipe];
[aTask setStandardOutput: pipe];

NSFileHandle *file;
file = [pipe fileHandleForReading];


[aTask setLaunchPath:@"bin/sh"];
[aTask setArguments:args];
[aTask launch];

Here are the errors:

2012-06-09 15:18:50.293 Auto Git[9404:403] launch path not accessible
2012-06-09 15:18:50.297 Auto Git[9404:403] (
    0   CoreFoundation                      0x00007fff870b4f56 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff90e35d5e objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff870b4d8a +[NSException raise:format:arguments:] + 106
    3   CoreFoundation                      0x00007fff870b4d14 +[NSException raise:format:] + 116
    4   Foundation                          0x00007fff9174f1f4 -[NSConcreteTask launchWithDictionary:] + 470
    5   Auto Git                            0x0000000109e1365d -[Push push:] + 765
    6   CoreFoundation                      0x00007fff870a470d -[NSObject performSelector:withObject:] + 61
    7   AppKit                              0x00007fff8e0f8f7e -[NSApplication sendAction:to:from:] + 139
    8   AppKit                              0x00007fff8e0f8eb2 -[NSControl sendAction:to:] + 88
    9   AppKit                              0x00007fff8e0f8ddd -[NSCell _sendActionFrom:] + 137
    10  AppKit                              0x00007fff8e0f82a0 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 2014
    11  AppKit                              0x00007fff8e177fc4 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 489
    12  AppKit                              0x00007fff8e0f6eaa -[NSControl mouseDown:] + 786
    13  AppKit                              0x00007fff8e0c2348 -[NSWindow sendEvent:] + 6306
    14  AppKit                              0x00007fff8e05ba55 -[NSApplication sendEvent:] + 5593
    15  AppKit                              0x00007fff8dff20c6 -[NSApplication run] + 555
    16  AppKit                              0x00007fff8e26e244 NSApplicationMain + 867
    17  Auto Git                            0x0000000109e12eb2 main + 34
    18  Auto Git                            0x0000000109e12e84 start + 52
    19  ???                                 0x0000000000000003 0x0 + 3
)

What am I doing wrong? Please help. Thanks guys.

  • 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-06-05T11:22:59+00:00Added an answer on June 5, 2026 at 11:22 am

    The launch path should be /usr/bin/git and your array should be @[@"commit",@"-m",yourarg] You need to create a different task for each command. Your add, push need to be seperate tasks. To find the path of git, in the terminal run the command which git This will be the path for your tasks.

    NSTask* task = [[Task alloc] init]
    //set the input output pipes
    [task setLaunchPath:@"/usr/bin/git"];
    NSArray* args = [NSArray arrayWithObjects:@"commit",@"-m",commitMessage];
    [task setArguments:args];
    //set up the notifications
    [task launch];
    

    If you want to use a shell script i think you would need to give it more formatting such as:

    NSString* shScript = [NSString stringWithFormat:@"#!bin/sh\ngit commit -m %@\ngit add ...\ngit..."
    

    set it up the same as above with the only argument in the array that string and the launch path /bin/sh

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run some basic javascript code with JSF 2. I'm using the
I'm trying to create a Tile rendering program. Heres some basic code. Header class
Ultimately I am trying to run some code which depends on the value (or
I am trying to run some Scala code on my OSX machine and keep
I'm a student, and I'm trying to write and run some test code for
I'm trying to build a simple .Net wrapper around some basic C++ code. The
Hey I am trying to just set up the basic structure for some basic
I have a form that I'm trying to run some basic validation on using
I'm trying to run some statistics over the Stack Overflow data dump, and for
I'm trying to run some nodejs apps in Notepad++ . I installed NppExec and

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.