PDA

View Full Version : Making an Uninstaller.




BlindSoul
Dec 25, 2011, 01:41 PM
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
Dec 25, 2011, 02:22 PM
Tell us about your application.

Does it consist of a single Application bundle, or, are there multiple files spread about the system?

BlindSoul
Dec 25, 2011, 04:44 PM
It's based on two .app Files.

lloyddean
Dec 25, 2011, 05:09 PM
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
Dec 25, 2011, 06:16 PM
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
Dec 26, 2011, 03:26 AM
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
Dec 26, 2011, 03:46 AM
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/mac/ipad/#documentation/Darwin/Reference/ManPages/man1/pkgutil.1.html

BlindSoul
Dec 26, 2011, 04:04 AM
I really have no clue what you just said, but thanks!

KnightWRX
Dec 26, 2011, 07:14 AM
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
Dec 26, 2011, 02:59 PM
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
Dec 26, 2011, 07:38 PM
Is there a reason you need to make the hidden .app bundle external to the visible .app bundle?

BlindSoul
Dec 26, 2011, 11:16 PM
Yes, the external .app requires the other .app which is hidden because there's no reason for people to use it.

chown33
Dec 26, 2011, 11:57 PM
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
Dec 27, 2011, 06:22 AM
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
Dec 27, 2011, 06:37 AM
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:

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");
}

BlindSoul
Dec 27, 2011, 07:50 AM
To make the Installer I've used JAMF Composer.

chown33
Dec 27, 2011, 09:18 AM
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
Dec 27, 2011, 10:14 AM
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.