Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

pinsrw

macrumors regular
Original poster
May 30, 2010
194
0
Hi all,

I need to do some old fashioned C-based Carbon coding, and I'm having a little problem. My program is coded I think normally, and when I put the executable into myapp.app/Content/MacOS, and invoke it by double-clicking on myapp.app, everything works fine... The app window comes up and my graphics is displayed.

However when I try running my executable from the command-line, the window comes up blank and is behind other windows. Can anyone here with Carbon knowledge hazard a guess as to why this might be and how to fix it?

Thanks.
 
You need to use the 'open' command at the terminal to launch application bundles.

open -a TextEdit

Will launch the TextEdit application. No need to provide the .app extention.

Unless the application is in your path try using:

open -a path/to/your/appbundle
 
You need to use the 'open' command at the terminal to launch application bundles.
open -a TextEdit
Will launch the TextEdit application. No need to provide the .app extention.
Unless the application is in your path try using:
open -a path/to/your/appbundle

Now I'm getting stranger results than before. When I do this:

Code:
$ open my.app/Contents/MacOS/my

It produces the same blank window in the background but it also products a Terminal with some minor shell errors printed.

When I do this I get an error and no application window appears:

Code:
$ open -a my.app/Contents/MacOS/my

Unable to find application named 'my.app/Contents/MacOS/my'
 
Point to the bundle with open, not the executable in the bundle.

Well yes, doing "open ./my.app" works fine.

But I want to run the executable like so
Code:
$ cd my.app/Contents/MacOS ; ./my
... ignoring the bundle.

I know that this is possible, because some GUI-based executables do run OK from the command-line. For instance, I can already do this with another application that I wrote, but it's one where the GUI subsystem is a library that I borrowed (kind of like wxwidgets), thus I didn't write its GUI initialization. I'm left wondering how they coded it such that one can run the executable from the command line.
 
Try this:
Code:
$ cd my.app/Contents/MacOS | ./my

It comes up behind the Terminal window, but its contents are filled in.
Also the application list (command-Tab) does not show it.
Any ideas?
Thanks.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.