How to Create .app

Discussion in 'Mac Programming' started by moore1879, Aug 15, 2008.

  1. macrumors newbie

    Joined:
    May 22, 2008
    #1
    I have run into this before but never thought to post to a forum. I like open source software, however sometimes it's annoying to install an application and only have it open via command line. This brings me to the question, if I have the source code, what would it take to create a .app from that? Let us assume that there are no dependencies.

    A link, a step-by-step walk through, anything like that would be helpful.

    I am running 10.4 and have Xcode installed.
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    A .app is a GUI application. So if you have code meant for the command line, you would need to figure out how to wrap a GUI around it. And to do that you need to learn Cocoa. Easiest way to get started is Xcode > File > New Project > Cocoa Application. That will give you the essentials but you may want to look into a Cocoa tutorial to go further.
     
  3. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #3
    It would be 100x easier to just write a little GUI utility that makes calls to the command line than actually rewriting the command line tool to have a GUI itself.
     
  4. thread starter macrumors newbie

    Joined:
    May 22, 2008
    #4
    Take, for example, GIMP. You can install it using MacPorts. When you do it has a gui that runs using X11. However, you don't get a .app directory for it. So, you must run it using a command line call. How can you take an application like that and turn in into a .app?

    For the record, GIMP is just an example. That is not why I want to do this.
     
  5. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #5
    Why do you need too? Just install the command line tool and the write a GUI application that just makes calls to the command line tool. Then all you need to do is run the GUI application and it will handle all the command line stuff for the user.

    You don't need to touch the original applications source at all.
     
  6. thread starter macrumors newbie

    Joined:
    May 22, 2008
    #6
    Because the application already has a GUI. I don't need to create the GUI. The only way to run the application is to type in the name of the application. I can run the application, but it has to be run from the terminal window. I can type in "eric". and it runs the application; however, if I close the terminal window, it kills the application. I can run it from an applescript, but the applescript must continue to run or the application is killed. Why would I write a GUI for an application that already has a GUI?
     
  7. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #7
    Because you didn't state that at the start. If you want someone to give you a solution to a problem, in general it best to describe exactly the problem you have.

    In that case if you really want to do it that way, I can only suggest you import the current build files into Xcode and then set the project up to compile a .app for you. You'll probably need to muck around with makefiles depending on the application.
     
  8. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #8
  9. macrumors 6502

    Joined:
    Oct 2, 2003
    Location:
    Sydney, Australia
    #9
    So you just want to call the command line to start the app, but not have it via a terminal window. I'd write a tiny shell script to do that, and then save it as "blah.command". IIRC, that will be double-clickable and will auto launch a terminal window and then run your script. If you want to have it do it without a terminal window, make your script launch your "app" in the background (I think you can just put a "&" on the end of the call, not sure). It's been years since I did this, I think the terminal shows up still, but you can close it and your thing will still be running.
     

Share This Page