Mac App Gui executing bash script

Discussion in 'Mac Programming' started by webking, Apr 24, 2016.

  1. webking macrumors newbie

    Joined:
    Apr 24, 2016
    #1
    Hi.

    I hope someone can guide me to the right directions.

    Basically I would like to create a program for mac OSx such as my_program.app and of course it has a GUI and a few buttons and display area which allow the GUI to be able to show the results of the bash script inside the GUI and not in terminal. Will Xcode work for this type of thing?

    Please assist. Thank you so much.
     
  2. superscape, Apr 25, 2016
    Last edited: Apr 26, 2016

    superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #2
    Absolutely, Xcode will work. Although if you don't know any Objective-C or Swift then it's a steep learning curve. (You need to be looking at NSTask: https://www.raywenderlich.com/125071/nstask-tutorial-os-x )

    Alternatively, if you'd be satisfied with just popping up a few user dialogs and maybe dumping the results into a text file then AppleScript might be a better option. You'll probably get going quicker. Or possibly you might use Automator - I posted a guide to using Automator to make shell scripts more user friendly a while ago: https://www.ghostotter.com/making-shell-scripts-little-user-friendly/

    So, in short, yes you can use Xcode to create a GUI for a shell script but there will be a steep learning curve. You might see results faster if you have a more basic GUI and use AppleScript and/or Automator instead.

    Good luck!
     
  3. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #3
    As mentioned, Xcode does have a fairly steep learning curve, in addition to the Cocoa frameworks. Depending on your experience and how much time you want to invest, you might also take a look at Pashua.
     
  4. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #4
    Interesting. I've not seen that before. Thanks for mentioning it.
     

Share This Page