File:  [NetBSD Developer Wiki] / wikisrc / pkgsrc / how_to_use_pkgsrc.mdwn
Revision 1.3: download - view: text, annotated - select for diffs
Fri May 3 16:36:46 2013 UTC (11 months, 2 weeks ago) by asau
Branches: MAIN
CVS tags: HEAD
Remove outdated, suboptimal, and misleading information.
Point to The pkgsrc Guide instead.

Noticed by 7heo@7heo.tk on IRC.

**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 A/UX]]
* [[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]]

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb