Uninstalling stuff (esp. AUs and VSTs) on OSX

Configure and optimize you computer for Audio.
Post Reply New Topic
RELATED
PRODUCTS

Post

OSX is cool, but suffers heavily in certain areas. Package management is one of them - the Windows (un)installer is superior by miles with all its faults. Mainly because OSX doesn't have one.

With most apps that are installed by drag-and-dropping, this isn't a problem. VSTs and AUs are however usually installed via .pkg files, where it does become one if you want to get rid of the expired trial version of a bloodyexpensive synth you didn't like.
Also it's the same with anything installed from the Mac App store.

For apps and browser plugins, there are third party tools to help removal. Not for AUs and VSTs though! (Weird, as OSX does have a central repository of installation receipts.)

There are instructions out there on using command line to purge packages. What worked for me is the following:

Code: Select all

$ cd /
$ pkgutil --only-files --files the-package-name | tr '\n' '\0' | xargs -n 1 -0 sudo rm
$ pkgutil --only-dirs --files the-package-name | tr '\n' '\0' | xargs -n 1 -0 sudo rmdir
$ sudo pkgutil --forget the-package-name.pkg
(DO NOT USE THIS CODE IF YOU ARE UNFAMILIAR WITH THE OSX COMMAND LINE AND DON'T KNOW WHAT YOU ARE DOING! Some package receipts contain shared and system files that were only UPDATED by the install, and deleting them can render the system unusable.)

While I'm thinking of writing a program to help list and remove packages similar to the "add and remove programs" util in Windows, I'm really wondering why nobody did this before me.
Maybe I just didn't look hard enough, and someone knows the holy grail for this problem. How do YOU remove AUs and VSTs from your Mac?
Last edited by D.Josef on Fri Apr 06, 2012 8:34 am, edited 1 time in total.

Post

Well I had enough and made a script that will help remove pkgs. Here it is. You CAN shoot yourself in the foot with it, but it's reasonably safe and helps you stay safe.
It creates an uninstall script (to be run with sudo) for the package(s) specified that you need to review before running to avoid deleting vital files.

Code: Select all

#!/bin/sh

#check command line
if [ $# -ne 1 ] ; then
	echo "Usage: $0 [pkgname]"
	exit 1
fi

#check package availability
PKGS=$(pkgutil --pkgs=${1})
if [ $? -ne 0 ] ; then
	echo "Package ${1} not found"
	exit 1
fi

#newline as separator
IFS=$'\n'

#prepare command file
SAFEEXP=${1//[^a-zA-Z0-9.]/_}
FILENAME="uninstall_${SAFEEXP}.sh"
if [ -e ${FILENAME} ] ; then
	rm ${FILENAME}
fi
touch ${FILENAME}

#build command file base
echo "#!/bin/sh\n\necho 'Do not run before reviewing file list!'\nexit 1\n\n#uninstall file for:" >> ${FILENAME}
for pkg in ${PKGS} ; do
	echo "# ${pkg}" >> ${FILENAME}
done
echo >> ${FILENAME}

#file deletions
echo "#Files to be removed:" >> ${FILENAME}
for pkg in ${PKGS} ; do
	echo "#package ${pkg}" >> ${FILENAME}
	for element in $(pkgutil --only-files --files ${pkg}) ; do
		echo "rm '/${element}'" >> ${FILENAME}
	done
done
echo >> ${FILENAME}

#dir purge
echo "#Directories to be removed if empty:" >> ${FILENAME}
for pkg in ${PKGS} ; do
	echo "#package ${pkg}" >> ${FILENAME}
	for element in $(pkgutil --only-dirs --files ${pkg} | sort --reverse) ; do
		echo "rmdir '/${element}'" >> ${FILENAME}
	done
done
echo >> ${FILENAME}

#forget removed packages
echo "#Unlink packages:" >> ${FILENAME}
for pkg in ${PKGS} ; do
	echo "pkgutil --forget ${pkg}" >> ${FILENAME}
done

#finish
chmod +x ${FILENAME}
echo "Uninstaller script ${FILENAME} created."
To list the packages installed on the system:

Code: Select all

$ pkgutil --pkgs | less

Post

Hey can you explain this to me in english. I too am having a really hard time uninstalling on OSX. I have no idea how to run this script you posted.


[quote="D.Josef"]Well I had enough and made a script that will help remove pkgs. Here it is. You CAN shoot yourself in the foot with it, but it's reasonably safe and helps you stay safe.
It creates an uninstall script (to be run with sudo) for the package(s) specified that you need to review before running to avoid deleting vital files.

[code]#!/bin/sh

#check command line
if [ $# -ne 1 ] ; then
echo "Usage: $0 [pkgname]"
exit 1
fi

#check package availability
PKGS=$(pkgutil --pkgs=${1})
if [ $? -ne 0 ] ; then
echo "Package ${1} not found"
exit 1
fi

#newline as separator
IFS=$'\n'

#prepare command file
SAFEEXP=${1//[^a-zA-Z0-9.]/_}
FILENAME="uninstall_${SAFEEXP}.sh"
if [ -e ${FILENAME} ] ; then
rm ${FILENAME}
fi
touch ${FILENAME}

#build command file base
echo "#!/bin/sh\n\necho 'Do not run before reviewing file list!'\nexit 1\n\n#uninstall file for:" >> ${FILENAME}
for pkg in ${PKGS} ; do
echo "# ${pkg}" >> ${FILENAME}
done
echo >> ${FILENAME}

#file deletions
echo "#Files to be removed:" >> ${FILENAME}
for pkg in ${PKGS} ; do
echo "#package ${pkg}" >> ${FILENAME}
for element in $(pkgutil --only-files --files ${pkg}) ; do
echo "rm '/${element}'" >> ${FILENAME}
done
done
echo >> ${FILENAME}

#dir purge
echo "#Directories to be removed if empty:" >> ${FILENAME}
for pkg in ${PKGS} ; do
echo "#package ${pkg}" >> ${FILENAME}
for element in $(pkgutil --only-dirs --files ${pkg} | sort --reverse) ; do
echo "rmdir '/${element}'" >> ${FILENAME}
done
done
echo >> ${FILENAME}

#forget removed packages
echo "#Unlink packages:" >> ${FILENAME}
for pkg in ${PKGS} ; do
echo "pkgutil --forget ${pkg}" >> ${FILENAME}
done

#finish
chmod +x ${FILENAME}
echo "Uninstaller script ${FILENAME} created."[/code]

To list the packages installed on the system:
[code]
$ pkgutil --pkgs | less
[/code][/quote]

Post

Hey, sorry for not coming back earlier.

If you just needed a user's manual for the script, it goes like this. Install a developer's text editor (the OSX text editor is not okay for this), copy the code, save it as uninstall.sh, and set it executable.

Then, you use it by calling:

Code: Select all

$ ./uninstall.sh {packagename}
Packagename is the name of the package that pkgutil will list when you call

Code: Select all

$ pkgutil --pkgs | less
This will generate a new script, called uninstall_{packagename}.sh, which you can use this way:

Code: Select all

$ sudo ./uninstall_{packagename}.sh
HOWEVER, if you are unfamiliar with running shell scripts, this script is perfectly fit for destroying your entire OSX installation. You MUST review the script before running it, in fact it contains a safety mechanism that won't let you run it before editing it manually.

Please read up on BASH and BASH scripts, UNIX file ownership and permissions (chown and chmod), and UNIX file systems. Linux sites will usually have a primer that explains all that in a few pages.

Then, read up on the OSX package management system, and the reason Apple does not provide an uninstaller.

If you understand all that, you will know how to use the script above.

Post Reply

Return to “Computer Setup and System Configuration”