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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:30:15+00:00 2026-06-15T09:30:15+00:00

I am trying to build a Gui for homebrew on mac , with objective-c,

  • 0

I am trying to build a Gui for homebrew on mac , with objective-c, but when i try to see the installed packages with the following code it return empty but if i try other command like update it gives me the result, I tried the same with java and the same error occurs.

Git page: feel free to help the project, the code might have a lot of errors I am new to objective-c.

NSTask *task;
task=[[NSTask alloc]init];
[task setLaunchPath:@"/Users/rogeriop062/homebrew/bin/brew"];

NSArray *arguments;
arguments = [NSArray arrayWithObjects:@"list",nil];
[task setArguments: arguments];

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


NSFileHandle *file;
file=[pipe fileHandleForReading];

[task launch];


NSMutableData *data=[NSMutableData dataWithCapacity:1000];

while ([task isRunning]) {

    [data appendData:[file readDataToEndOfFile]];
}
[data appendData:[file readDataToEndOfFile]];


NSString *string;
string =[[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"result: %@\n",string);
  • 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-15T09:30:16+00:00Added an answer on June 15, 2026 at 9:30 am

    That’s an interesting project; good for you! Homebrew works very nicely on my Mac. I can’t see anything wrong with your code. I pasted your code into a test routine on my iMac and it worked perfectly. It listed the programs that I had installed with brew. One per line, which I didn’t expect, but it worked. Sorry.

    You could also try this. Delete everything in your method from[task launch] to the end, and replace it with this:

    task.terminationHandler = ^(NSTask *blockTask) {
        NSMutableData *data=[NSMutableData dataWithCapacity:1000];
        [data appendData:[file readDataToEndOfFile]];
        NSString * string =[[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
        NSLog(@"result: %@\n",string);
    };
    [task launch];
    

    and that produces the same results as your code on my machine – it works, I’m afraid – but it will not take compute time waiting for the result.

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

Sidebar

Related Questions

I am using cmake-gui trying to build opencv but get this error: CMake Error
I'm trying to build a calculator GUI using migLayout, but I'm not familiar with
Trying to save data from active UI build in GUI back to spreadsheet. But
I am trying to build a GUI that has three horizontal sliders that control
I'm trying to build a GUI window in my application. What I'm trying to
I was trying Build For Archiving application (from Titanium Mobile) with xCode 4.4, but
I'm trying build a MVC framework, but I'm confused about manage themes. Well... I
I am trying to build up a GUI interface similar to the figure. Basically,
I am trying to build a simple menu-based GUI with J2ME. The menu entries
I have been trying to build c++ boost to work with qt creator but

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.