XCode question -- command line tool without terminal window

Any XCode gurus out there?

I’ve written a plain old command line tool using the XCode “Standard Tool” project thingy. (Bare with me; I’m an Emacs and make person.)

This tool does some simple Unixey stuff and then launches a Perl program which provides its own GUI through the excellent wX API. This works great, except when I double-click my executable, it opens a terminal window for stdin/out, which I don’t want since the app already has a GUI.

Do I have to use one of those far scarier project templates which come with six billion files (where the hell do I type “Hello World?”) Or is there an easy way to get the Standard Tool template to not open a terminal window?

BTW, one thing I tried was selecting the executable in XCode and doing “Get Info.” There are options under General and Debugging for where to send stdin/out; the default was “Psuedo Terminal.” I changed it to “System Console” and rebuilt but the behavior was the same.

BTW2, I know about CamelBones but I can’t use it for this particular app because it’s already been written for one thing, and the GUI needs to be portable to other platforms.

Any other ideas welcome. TIA.

You can’t do exactly what you want, because what you’re building isn’t a Mac executable at all – it’s actually Unix executable, which the MacOS considers to be a document that can be opened by a shell-savvy-app, usually terminal.

Terminal’s standard response to opening such a document is to run it in the current shell. You can change the association by finding the built executable in the Finder, doing a “Get Info” on it, and change the “Open With,” but as you’ll discover, it’s not very useful – whatever app you choose will try to open the executable as a document.

So you need to take another tack. Basically, you want to create a shell-savvy-app that can run your executable for you, and use it instead of terminal. You can do that the hard way by using one of XCode’s other options and using the system() call to launch your application.

Or, you can do it the easy way. Build your standard tool the way you are now, and put it in a known location. Then launch Automator (it’s in your applications folder), create a new automation, and add a “Run Shell Script” action.

In the box, replace whatever junk it put there with the path (absolute for now, but you can change it to relative once you’ve got the hang of it) to your unix executable. Click “Run” if you want to test it. Then select “Save as”, choose “Application” as the type, and name your new application.

Now you’ve got an application that when double clicked will run your executable, basically doing the same thing Terminal does, without displaying the terminal window. If you don’t like the weird spaceman icon, you can cut-and-paste a new icon into it’s Get Info window, just like any other Mac file.

On edit: if the “simple Unixy stuff” can be done via shell commands, you could skip writing the tool altogether and just use Automator as your Perl launcher.

I don’t know if this helps, but there’s a very cool App called “Drop Script” that turns shell scripts into Droplets: Papers

TimeWinder, you are my hero! Automater works perfectly.

I can do everything I need with a shell script so I don’t need to write any C at all.

Hooray!