**Contents** [[!toc levels=2]] #What is pkgsrc Pkgsrc [spoken: package source] is the main package management framework for NetBSD. With pkgsrc you can easily add, remove and manage software on your system. Pkgsrc is basically a set of files, grouped by categories which contain information to install the software you have selected. All these files together are mostly referred to as the pkgsrc tree. This tree is maintained by the pkgsrc developers, who make changes to it every day. Therefore it is necessary to update the pkgsrc tree regularly. #Documentation It is strongly advised to rely on information in [The pkgsrc Guide](http://www.netbsd.org/docs/pkgsrc/) This wiki is semi-official and is frequently outdated. Sometimes even misleading. #Preparing pkgsrc ##Obtaining the current pkgsrc source tree See [The pkgsrc Guide](http://www.netbsd.org/docs/pkgsrc/getting.html) ##Creating WRKOBJDIR To keep the tree clean and your work directories out of it, create a directory, e.g. # mkdir /usr/work and define WRKOBJDIR in /etc/mk.conf: WRKOBJDIR=/usr/work ##Creating DISTDIR We also want our distfiles to be stored, outside of the pkgsrc directory. Therefore we add the DISTDIR variable to /etc/mk.conf DISTDIR=/usr/distfiles and create it with: # mkdir /usr/distfiles #Installing packages To install packages, we need to become root. $ su then we change to the directory (category) and then to the package we want to install. # cd /usr/pkgsrc/misc/figlet to install we enter # make install afterwards we clean up and enter # make clean if this was a package with dependencies, we also enter # make clean-depends You can put them all in one line too. # make install clean clean-depends If you wish to clean the distfiles, the files that have been downloaded, you enter # make distclean #List Packages $ pkg_info #Removing Packages # pkg_delete packagename #Updating Packages You can update a single package using make update. # make update #On-line help Besides [The pkgsrc Guide](http://www.netbsd.org/docs/pkgsrc/) there is also a built-in on-line help system. # make help gives you the usage information. This requires you to already know the name of the target or variable you want more info on (just like man does). Most targets and variable names are documented, but not all are. See also * [[How to use pkgsrc mounted over NFS]] * [[How to use pkgsrc on AIX]] * [[How to use pkgsrc on IRIX]] * [[How to use pkgsrc on Linux]] * [[How to use pkgsrc on Mac OS X] * [[How to use pkgsrc on OSF1]] * [[How to use pkgsrc on Solaris]] * [[pkgsrc/Solarish]]