# [PC-BSD] Using ports and packages interchangeable



## choosy (Dec 16, 2013)

Hi,

I am using FreeBSD (lately switched to PC-BSD) on my laptop. I have some questions that have been bugging me for a while related to how ports and packages work. I couldn't find the answers of my specific questions in Chapter 5 of the Handbook. I use ports and packages interchangeably on my system. Meaning, I install using either method, I uninstall using either method and I'm thinking I could upgrade using either. 

Questions: are they suppose_d_ to work like that? More specifically, if I install from ports, do I get the same end result (supposing the compilation options are the same) as installing from a package? Are the same files installed in the same location? When I install a port, the port and the installed dependencies are recorded in the same system (dependency tree) that is used by the package system? Is it possible that what I have installed on my system gets out of sync with what the package/port system "thinks" I have installed? Can I install a port, then use the package tools to upgrade it, or the other way around? Or can I install via ports, and uninstall via pkg, or the other way around?

Maybe I'm asking to_o_ many questions, if so, please point me to the right documentation/tutorial to read about it. Or maybe the right information will answer most of my questions, I'm aware I'm missing some basic part of how these things work.


Thank you,
Stefan


----------



## sossego (Dec 16, 2013)

The basic difference is that using pkg over /usr/ports allows a quicker install. Yes, you can install with the latter and deinstall with the former.


----------



## wmoreno3 (Dec 16, 2013)

I am using pkg `pkgng` and ports collection, I prefer ports collection in order to be update, packages are easy to install but difficult to make editing and a little outdated.
The other issue is the news about BDB and a lots of problems with pkg, I think that must be a wait for pkg stable, pkg dumps with db5. I am tired with `pkgng`. I hope FreeBSD 10 can solve some issues about.

```
Berkeley DB versions before and excluding 4.8 have been marked
  deprecated.  Please see https://wiki.freebsd.org/Ports/BerkeleyDBCleanup
  for upgrade instructions.
```


----------



## wblock@ (Dec 16, 2013)

Over the weekend, I switched a system from the old pkg_add tools to pkg.  It went mostly fine, no trouble related to pkg that was not my own fault.  The BDB changes were not terrible, but I was building from ports, not installing packages.


----------



## SirDice (Dec 16, 2013)

choosy said:
			
		

> Questions: are they suppose_d_ to work like that? More specifically, if I install from ports, do I get the same end result (supposing the compilation options are the same) as installing from a package? Are the same files installed in the same location? When I install a port, the port and the installed dependencies are recorded in the same system (dependency tree) that is used by the package system?


It can all be summarized fairly simply, a package is nothing more than a pre-compiled port. There is no difference between the two when they are installed.


----------



## fonz (Dec 16, 2013)

SirDice said:
			
		

> a package is nothing more than a pre-compiled port. There is no difference between the two when they are installed.


Except that packages may have been linked against certain versions of dependencies, which could be older or newer than what you have installed if you built (some of) those from ports. Usually that won't be much of a problem (you may get a warning but it will still work just fine anyway), but it can occasionally break things.


----------



## choosy (Dec 16, 2013)

Thank you for your responses! I can see the light now


----------



## wmoreno3 (Dec 16, 2013)

wblock@ said:
			
		

> Over the weekend, I switched a system from the old pkg_add tools to pkg.  It went mostly fine, no trouble related to pkg that was not my own fault.  The BDB changes were not terrible, but I was building from ports, not installing packages.


Me too, I am now with the pkg_* tools and ports collection to install, deinstall and update the ports tree. I switched BDB to db5 and I'm waiting for pkgng when it will be ready.


----------

