Tuesday, January 20, 2009

Tip: Remove all installed packages and ports on FreeBSD

This post provides the steps required to remove every installed package and port on a FreeBSD system. By following the bellow steps you'll end up with a barebones system composed by FreeBSD's userland and kernel without any third party applications.
  1. % su
  2. # pkg_delete -f -a
  3. # rm -rf /var/db/pkg /var/db/ports /usr/local
We've started by using pkg_delete to remove all packages and ports and finished by deleting every traces of them in the system (including ports selected build options).

And that's it!


Anonymous said...

Good tip, just what I have been searching for!

tangram said...

Glad to help ;)

Anonymous said...

I would add /var/db/ports/* to the list of things to remove if you want make sure it resets all the dialog boxes for software install. If you were happy with your previous choices and don't want to get asked again, don't delete this ;)

tangram said...

Yeah /var/db/ports/* for ports options and /var/db/pkg for package related stuff.

I'll update the post.

Best regards.

Anonymous said...

Greatest tip ever! Now I don't need to reinstall FreeBSD all the time.