If you've installed an application from a .pkg-type installer, Mac OS X keeps a listing of what was installed in the Library/Receipts folder -- either the top-level Library, or your user's Library. The lsbom command can be used to see this list, and to uninstall the application.
First, find the receipt. It will be in either ~/Library/Receipts or /Library/Receipts, as the name of the package. The actual bom ("bill of materials") file is located at, for example,
/Library/Receipts/some_app.pkg/Contents/Archive.bomUse the lsbom command to see what was installed:
lsbom -fls /Library/Receipts/some_app.pkg/Contents/Archive.bomYou can use this list to manually delete the items installed, or you can feed the list to rm to delete the installed files. Be sure to examine the list of files before trying to remove them -- this command will only work if the paths are relative to the root directory ("/"), and I haven't tried it with names with spaces. This will remove any installed files, though directories must be removed manually. I tested this using the Mac package for FontForge, and it successfully removed the program's files. I originally saw this code in this post in a Mac OS X mailing list (from 2002).
Mac OS X Hints