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

BlindSoul

macrumors 6502
Original poster
May 30, 2010
466
0
Israel
Hello,

I am interested in making an Uninstaller for my Mac application.
Does anyone have a simple guide to make one? even a Javascript uninstaller can be good?


Thank you very much!
 

lloyddean

macrumors 65816
May 10, 2009
1,047
19
Des Moines, WA
If it's simply a couple of application bundles I don't believe you should bother with either a installer, or a uninstaller.

The user only need remove the application bundles, a preference file, and it's gone. This is normal for the platform.

Don't make it more work than is necessary.
 

KnightWRX

macrumors Pentium
Jan 28, 2009
15,046
4
Quebec, Canada
Best advice I can give you is to use the Apple developer tools' PackageMaker (/Developer/Applications/Utilities/PackageMaker), make a .pkg file for your application.

Once that's done, you can probably make an uninstaller using a shell script (that will get installed with your app) or a third application which will read in the contents of your package's Receipt (/Library/Receipts) file to know what to remove from the system.
 

BlindSoul

macrumors 6502
Original poster
May 30, 2010
466
0
Israel
I should have an Uninstaller because one of the files are hidden.
I have a .pkg of Installation but how do I make a .shell file? What do I write in it? and where do I place it?
 

subsonix

macrumors 68040
Feb 2, 2008
3,551
79
You can create a uninstall script in any language. All you need to do is delete all files that belongs to the application. You could also potentially add an uninstall option as a menu post in the application itself. Same principle, delete all files that belongs to the application including the app itself and quit.

Package maker has a command line utility, that might be useful for your purpose, particularly the --forget option. There is also an unlink option, but it's apparently not safe to use and rely on, on it's own. More info about this at the pkgutil manpage: http://developer.apple.com/library/...Darwin/Reference/ManPages/man1/pkgutil.1.html
 
Last edited:

KnightWRX

macrumors Pentium
Jan 28, 2009
15,046
4
Quebec, Canada
I should have an Uninstaller because one of the files are hidden.
I have a .pkg of Installation but how do I make a .shell file? What do I write in it? and where do I place it?

A shell script is just that, a script written in a shell scripting language. On Mac, the bourne shell is the best candidate since you're guaranteed it will be there.

Place it with your application. Though as subsonix says, you could always just place a uninstall option in the root menu of your application and write your uninstall routine in Objective-C by reading in the receipt and using that information and your app's state to uninstall.
 

BlindSoul

macrumors 6502
Original poster
May 30, 2010
466
0
Israel
It's very good you guys say how it works and everything, but I need something simple. Some simple guide, Step by step. I am very noob in all these things, I never used xCode. I just used Composer to make my Installer.

So if anyone can guide me step by step, or send me an example and I will just edit it it would be great.

Thanks!
 

Sydde

macrumors 68030
Aug 17, 2009
2,552
7,050
IOKWARDI
Is there a reason you need to make the hidden .app bundle external to the visible .app bundle?
 

BlindSoul

macrumors 6502
Original poster
May 30, 2010
466
0
Israel
Yes, the external .app requires the other .app which is hidden because there's no reason for people to use it.
 

chown33

Moderator
Staff member
Aug 9, 2009
10,740
8,416
A sea of green
Yes, the external .app requires the other .app which is hidden because there's no reason for people to use it.

I think Sydde's point was "Why don't you just embed the hidden app within the visible app?". An app-bundle can contain other executables, including complete other app-bundles.

If the hidden app is embedded in the visible app, then for users, it appears to be a single app. They can move it, delete it, etc. and never lose the hidden app, because it's embedded in the visible app bundle.

Also, by embedding the hidden app, the visible app always knows exactly where to find the hidden app: in its own app bundle.

I can't immediately think of an example of an app bundle embedded in another app bundle. However, if you look inside Activity Monitor.app, located in the standard /Applications/Utilities folder, you'll see two executables. One is the privileged data-collection daemon.
 

BlindSoul

macrumors 6502
Original poster
May 30, 2010
466
0
Israel
That's a great idea, I think it would be the best thing to do, though I don't know how to do that... I really have no skills in xCode or such, It feels like chinese to me.
 

wrldwzrd89

macrumors G5
Jun 6, 2003
12,110
77
Solon, OH
That's a great idea, I think it would be the best thing to do, though I don't know how to do that... I really have no skills in xCode or such, It feels like chinese to me.
How are you creating both .app bundles? If you're using a packager outside of Xcode, such as py2app/PyInstaller (Python), Jar Bundler (Java), or some other packager, the solution involves modifying how the first .app loads its resources, by altering the resource search path.

There are several ways of doing this, but the exact method is going to depend on your packager and programming language. An example is provided, for Java applications packaged with Jar Bundler:
Code:
if (new File("../../MacOS/JavaApplicationStub).isExecutable()) {
    // We are inside a Mac OS X-style application package
    // Load the embedded application
    Runtime.getRuntime().exec("../SecondApp.app/Contents/MacOS/SecondApp");
}
 

chown33

Moderator
Staff member
Aug 9, 2009
10,740
8,416
A sea of green
To make the Installer I've used JAMF Composer.

JAMF Composer only makes installers. It doesn't make the apps to install.

How did you make the actual apps? The reason we're asking is because you said you didn't use Xcode.

We're now back again to post #2: Tell us about your applications.
This time, please provide more specific information on how you wrote it, in what language, using what tools or IDE.
 

BlindSoul

macrumors 6502
Original poster
May 30, 2010
466
0
Israel
The hidden application is Prism, an Application which creates webApp into Mac Application, then I made my installer to install Prism and my webApp created with Prism, and that's why I need both cause else my webApp won't load.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.