what is the best way to remove a program?

Pieter de Goeje pieter at degoeje.nl
Sun Jun 14 14:06:18 UTC 2009

On Sunday 14 June 2009 14:58:46 Mark Hartkemeyer wrote:
> I was installing the mysql51-server port and I had a message that the
> install could not proceed, because mysql50-client was already
> installed.  I simply ran a "cd" and then a "make deinstall" in the
> mysql50-client directory.  Is this is the best way to remove a
> program?  Does it depend on how the program was added (compiled versus
> prebuilt binary added with pkg_add -r)?  I've tried pkg_delete in the
> past, but it seems to always complain about dependencies and not
> actually remove the program.
> Thanks,
> Mark Hartkemeyer

"make deinstall" is a good way to remove a program, but it ignores 
dependencies as you discovered. Some other program on your system requires 
mysql50-client to function and might now be broken.
pkg_delete -f does basically the same. pkg_deinstall (which comes with 
portupgrade) also does the trick.

Before doing a "make deinstall" you can check which installed packages require 
it by:
pkg_info -Rx mysql-client

If you want to upgrade mysql-client from 5.0 to 5.1, use portupgrade:
portupgrade -rf -o databases/mysql51-client mysql-client

This will replace mysql50-client with mysql51-client and reinstall all ports 
depending on mysql50-client ("-rf"), so they will use the new version. In this 
case the last step probably isn't necessary because the libraries are (mostly 
I think) compatible, but in general it is recommended.

For more information, see "man ports" and "man portupgrade".

Pieter de Goeje

More information about the freebsd-questions mailing list