# how do I de-install all the ports on my system?



## doughy (Apr 2, 2011)

I upgraded from 8.0 to 8.2. reading the freebsd-update procedure in the Handbook it says you either need to rebuild or re-install all the third party software on the system since that software may depend on libraries which have been removed during the upgrade process. I wanted to just de-install all the software on my pc since I have a lot of packages I don't need. How do I do this?


----------



## wblock@ (Apr 2, 2011)

Make a list of everything that's installed first:
`# pkg_info > /root/packagelist.txt`

Then deinstall all the packages:
`# pkg_delete -a`


----------



## ian-nai (Apr 2, 2011)

wblock said:
			
		

> Make a list of everything that's installed first:
> `# pkg_info > /root/packagelist.txt`



Am I wrong for thinking that will list all extraneous software installed - be from packages or ports?

I was under the impression that "pkg_" programs dealt with packages (binaries) and that "port*" programs dealt with ports (3rd party stuff - which is what the OP is after).


----------



## wblock@ (Apr 2, 2011)

A package is what you get from building a port.  Yes, *pkg_info -a* will list everything that's been installed.  That's so you can go back later and see what you had installed.  Not required, just handy to have.


----------



## ian-nai (Apr 2, 2011)

OH, I see now.  I thought there was some implicit relationship between the two commands.  *pkg_delete -a* actually removes everything.  That's got to be handy sometime.


----------



## DutchDaemon (Apr 2, 2011)

You may need *pkg_delete -af* to prevent running into errors about packages that are depended on by not yet removed other packages. Not sure if *pkg_delete -a* sorts this out before actually removing stuff.


----------



## graudeejs (Apr 2, 2011)

I simply backup my local etc and then

```
# rm -Rf /usr/local/*
# rm -Rf /var/db/pkg/*
```

and since I have also texlive installed this is much, much faster than *pkg_delete*


----------



## DutchDaemon (Apr 2, 2011)

That's correct, but be sure to save anything that was customised in /usr/local/etc/. Would be a pity to lose that difficult configuration you spent days on ..


----------



## graudeejs (Apr 2, 2011)

That's why I
`# zfSnap -a 2w -r -p bak_ tank`


----------

