A pkginfo item may optionally contain an installcheck_script. Install ckeck script provides a method for determining if an software item needs to be installed, where providing installs/receipts is inadequate or impractical. Command-line tools typically installed through port (macports) or Python modules installed using easy_install or pip are prime examples as they provide no easy method for determining their installed version.

An install check_script should be written such that an exit code of 0 indicates that the item is currently not installed and should therefore be installed. All non-zero exit codes indicate that the item is installed.

An example of installcheck_script illustrating a check to determine if the current version of the argparse Python module is installed.



# Grab current version of installed python module

version="$(python -c 'import argparse;print argparse.__version__' 2>/dev/null)"

# Compare with the version we want to install

if [ ${version:-0} < 1.2.1 ]; then

exit 0


exit 1


Uninstall Check Script

Optionally, an explicit uninstallcheck_script can be provided to determine whether or not an software item should be removed. In this case, the script with an exit code of 0 indicate that the item is currently installed and that removal should occur. All non-zero exit codes indicate that the item is not installed.