Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: How to run mac osx console app


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 3 - Last Post: Dec 1, 2017 12:11 AM Last Post By: Frank Staal Threads: [ Previous | Next ]
Karu Kaarigar

Posts: 141
Registered: 11/27/08
How to run mac osx console app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 26, 2017 10:23 AM
I have built a console app targeting the mac osx. It runs well when I run it from the IDE debugger. After I deploy it from the IDE, it runs well from command line in the osx terminal also. But why do I have to pass a complete command ./myapp.app/Contents/MacOS/myapp in order to execute it? If it's a bundle, should I not be able to run by using the open command or by double-clicking it? Thank you for the help.
Karu Kaarigar

Posts: 141
Registered: 11/27/08
Re: How to run mac osx console app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 30, 2017 10:32 AM   in response to: Karu Kaarigar in response to: Karu Kaarigar
Karu Kaarigar wrote:
I have built a console app targeting the mac osx. It runs well when I run it from the IDE debugger. After I deploy it from the IDE, it runs well from command line in the osx terminal also. But why do I have to pass a complete command ./myapp.app/Contents/MacOS/myapp in order to execute it? If it's a bundle, should I not be able to run by using the open command or by double-clicking it? Thank you for the help.
Can someone please comment on this - I would like to bundle the osx console app such that users can execute it straight by just entering its binary name at the terminal command prompt. I am deploying app as a Normal app, not AppStore app. Thank you in advance!
Brian Hamilton ...

Posts: 556
Registered: 10/14/04
Re: How to run mac osx console app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 30, 2017 4:43 PM   in response to: Karu Kaarigar in response to: Karu Kaarigar
Karu Kaarigar wrote:
Karu Kaarigar wrote:
I have built a console app targeting the mac osx. It runs well when I run it from the IDE debugger. After I deploy it from the IDE, it runs well from command line in the osx terminal also. But why do I have to pass a complete command ./myapp.app/Contents/MacOS/myapp in order to execute it? If it's a bundle, should I not be able to run by using the open command or by double-clicking it? Thank you for the help.
Can someone please comment on this - I would like to bundle the osx console app such that users can execute it straight by just entering its binary name at the terminal command prompt. I am deploying app as a Normal app, not AppStore app. Thank you in advance!

i have tested here
mu console app creates your normal .app bundle on the mac after deploying and I can execute that .app bundle Ok by double clicking it and it runs (i.e it shows hello world in a terminal window)
and then I can also run direct from a terminal window too
i,e change to the directory where the exectuable file is
i.e /yourapp.app/Contents/MacOS/
and run as
./yourapp
from that terminal winow

works here
Frank Staal

Posts: 115
Registered: 12/9/99
Re: How to run mac osx console app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 1, 2017 12:11 AM   in response to: Karu Kaarigar in response to: Karu Kaarigar
Karu Kaarigar wrote:
I have built a console app targeting the mac osx. It runs well when I run it from the IDE debugger. After I deploy it from the IDE, it runs well from command line in the osx terminal also. But why do I have to pass a complete command ./myapp.app/Contents/MacOS/myapp in order to execute it? If it's a bundle, should I not be able to run by using the open command or by double-clicking it? Thank you for the help.

a Mac .app is basically a bunch of directories pulled together, so that is why you will have to travel through Contents/MacOS, etc to get to the executable. Alternatively you can use the command
open <path to the app>/myapp.app


https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/open.1.html
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02