# Difference between portsnap and pkg



## Pixa (Mar 20, 2017)

Hello,
New to freeBSD : I just installed a FreeNAS server. It's very interesting : the ZFS and the jail concept are both stunning.
While going further, and installing some applications on the system, in tutorials, sometime to install package, "pkg" command is used, and some other times, the "portsnap" command plus "make install" are used.
So, I wonder what is the difference between portsnap and pkg : are they 2 different methods to do the same thing, or applications are either in the pkg system or in the portsnamp system.

Thanks.


----------



## SirDice (Mar 20, 2017)

PC-BSD, FreeNAS, NAS4Free, and all other FreeBSD Derivatives

portsnap(8) is used to update the ports tree (/usr/ports/), nothing more, nothing less. The pkg(8) tool is used to manipulate (install, delete, etc) packages.

Handbook: Chapter 4. Installing Applications: Packages and Ports


----------



## Pixa (Mar 20, 2017)

So, "portsnap" is used to keep the catalog of packages up to date, and "pkg" to install packages, right ?

Thank for (so quick) reply !


----------



## SirDice (Mar 20, 2017)

Pixa said:


> "portsnap" is used to keep the catalog of packages up to date


Catalog of ports actually. Ports are used to build packages.


----------



## sk8harddiefast (Mar 22, 2017)

FreeBSD has two different ways to do the same thing (install a package). You can do it using ports and configuring and compiling all the packages. You can do it using packages. Packages is prebuild ports with the default configuration. Ports are slower and "unstable" but you have the possibility to negotiate with dependencies and set flags. From the other side `pkg` as binary package manager is fast and stable. Is not compiling and is not so flexible cause of flags configuration lack. For old hardware machines better to deal with `pkg` way. On newer machines, just use ports and mixing pkg's and ports is not hurting your system 

Now `portsnap` is used to keep the catalog of every port on your system. To update all your ports tree you run `portsnap fetch extract`. To update your pkg catalog you run `pkg update`


----------

