Re: Best approach to write an uninstaller for osx
Re: Best approach to write an uninstaller for osx
- Subject: Re: Best approach to write an uninstaller for osx
- From: Jens Alfke <email@hidden>
- Date: Fri, 20 Nov 2009 23:26:57 -0800
On Nov 20, 2009, at 11:03 PM, Parimal Das wrote:
> I want to write a uninstaller for my app.
Are you sure it needs one? Most Mac apps don't have or need uninstallers. If you want to remove an app, you just drag its icon to the Trash. (There might be some preference files left behind, but they're not usually big enough to worry about.)
> What this un-installer need to do is- delete some files an the main app, and
> then delete itself.
> Steps what i found are
> 1. Un-install app will run a shell script to delete all.
> 2. It will use launchd to delete itself.
I don't think you need anything fancy to delete yourself. In Unix it's legal to delete an open file; the file contents don't actually get deleted until the last open file handle is closed.
Please be really, really careful about quoting paths in the shell script — the application may be installed in a location that has spaces or quotes in its name, so test those cases. The horrible example is an early iTunes installer script that would accidentally delete your home directory (or was it the entire disk?) if the name of the startup disk had a space in it.
—Jens_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden