site_archiver@lists.apple.com Delivered-To: installer-dev@lists.apple.com pkgutil --pkg-info <pkgid> /Library/Receipts/PackageName.pkg/Contents/Info.plist There's some Python code to do all of this in munki -- http://code.google.com/p/munki -Greg On Jul 15, 2009, at 2:30 PM, Charles E. Heizer wrote: Hello, I'm looking at creating a script to see if a package has been installed. So I have been looking through the man pages on pkgutil and installer and I dont see a logical way to join the two. If I run "installer -pkginfo -verbose" on a pkg I get some useful information but no package identifiers or package identifier version. So what is the best approach to query pkgutil for a package if you dont have a package identifier? thanks, Charles _______________________________________________ Do not post admin requests to the list. They will be ignored. Installer-dev mailing list (Installer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/installer-dev/site_archiver%40lists.a... In Leopard, pkgutil doesn't have info on all installed packages; it tracks only the new Leopard flat packages. What you have to do is first check pkgutil: If that turns up nothing, you'll need to loop through all the receipts in /Library/Receipts and examine the Info.plist files:
From the Info.plist, you'll need to look at CFBundleIdentifier and CFBundleShortVersionString.
Some packages also have a version.plist at /Library/Receipts/ PackageName.pkg/Contents/version.plist, which has additional version info. This email sent to site_archiver@lists.apple.com