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

jlobe

macrumors newbie
Original poster
Feb 2, 2010
9
0
Cali
Background:
I have a program I've been working on (for fun), which is---at its core---a command line program (C++). I've also added a Cocoa GUI, which fundamentally requires, uses and interacts with the C++ code. My conception of this program is for the GUI and the command-line elements to work in tandem.

Question:
How should I create an installer, or distributable package for this(these) program(s)? At the moment, I only want to give it to friends / colleagues - and thus don't need a fully professional installation package (although that wouldn't be bad). I have no experience with producing packaged applications, or installers, etc.

Any recommendations or pointers would be welcome. Relevant tutorials might be especially helpful, but I'm not sure what to look for as I need to install both a command line program, and a cocoa application----and the cocoa application needs to know where the command line program, and its associated files are.

Thanks!
 
You could put the C++ program into the MacOS directory of your app bundle, package the app bundle in a compressed .dmg file, and distribute the .dmg file. Installation would be simply dragging the app bundle into /Applications. Uninstallation would be simply dragging the app bundle into the trash. There would be no need for an installer.
 
Thanks for the response.
A precompiled executable of the C++ program you mean?

How would I make the C++ program executable from the command line? And how would I incorporate the path into the cocoa application?
 
A precompiled executable of the C++ program you mean?

Yes

How would I make the C++ program executable from the command line?

Install a symbolic link to the C++ program into /usr/local/bin giving the symbolic link a suitably non-generic name. Make this a function of the GUI. That way people who what it can install it, but by default you app doesn't pollute outside of it's bundle. Creating /usr/local/bin and the symbolic link will require elevated privileges so you might need a helper program, also in the MacOS directory of your app bundle.

And how would I incorporate the path into the cocoa application?

Code:
[[NSBundle mainBundle] URLForAuxiliaryExecutable:@"cppprogram"]
// or [[NSBundle mainBundle] pathForAuxiliaryExecutable:@"cppprogram"]
 
Creating /usr/local/bin and the symbolic link will require elevated privileges so you might need a helper program, also in the MacOS directory of your app bundle.

Elevated privileges can be a lot of unnecessary trouble.

Give the user the option of creating the symlink in the user's home directory (value of HOME env-var), or a sub-directory thereof. For example, I have a ~/bin, and I'd put it there.

As long as the symlink target is an absolute path (and it should be), the symlink can be moved at will without breaking. If the app bundle is moved, the symlink will break. Can't really help that, given the nature of symlinks.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.