File:  [NetBSD Developer Wiki] / wikisrc / pkgsrc / how_to_use_pkgsrc.mdwn
Revision 1.6: download - view: text, annotated - select for diffs
Thu Apr 27 11:25:42 2017 UTC (5 years, 9 months ago) by wiki
Branches: MAIN
CVS tags: HEAD
web commit by schmonz: update for rename of pkgsrc/How_to_use_pkgsrc_on_Solarish___40__Illumos_based__41__.mdwn to pkgsrc/solarish.mdwn


[[!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.


It is strongly advised to rely on information in [The pkgsrc Guide](
This wiki is semi-official and is frequently outdated.
Sometimes even misleading.

#Preparing pkgsrc

##Obtaining the current pkgsrc source tree

See [The pkgsrc Guide](

##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:


##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


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]( 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]]

CVSweb for NetBSD wikisrc <> software: FreeBSD-CVSweb