Given NetBSD focus on portability, it’s only logical that pkgsrc is also available on systems other than NetBSD, including Darwin (Mac OS X). Here are some notes showing to bootstrap pkgsrc in unprivileged mode, which means that everything can easily be installed in the user home directory.
Before starting, we need to install Xcode Command Line Tools to get a working compiler.
Fetching and extracing latest pkgsrc stable release
This will create a
~pkgsrc directory :
cd wget http://ftp.netbsd.org/pub/pkgsrc/stable/pkgsrc.txz tar xfz pkgsrc.txz
Launching the bootstrap script and setting the ABI to 64-bit :
cd pkgsrc/bootstrap ./bootstrap --abi=64 --compiler=clang --unprivileged
This will create and start populating the
~pkg directory where all built packages will be installed.
For a complete list of available options :
~pkg to the path :
Fetching security vulnerabilities information :
Adding some acceptable licenses to our pkgsrc configuration :
echo "ACCEPTABLE_LICENSES+= vim-license" >> ~/pkg/etc/mk.conf
Here is how to build a package and clean the working directory and all dependencies :
cd ~/pkgsrc/category/package bmake install clean clean-depends
Keeping pkgsrc up-to-date
First, we need to build CVS :
cd ~/pkgsrc/devel/scmcvs bmake install clean clean-depends
We can then update pkgsrc using the following command :
cd ~/pkgsrc && cvs update -dP
Checking for security vulnerabilities in packages :
Installing CA certificates
For more details, please read the following post : Installing CA certificates on NetBSD.
Using binary packages
After running Fink in 2009 on my Mac mini, and then Homebrew since late 2011 on my MacBook Pro, it’s nice to explore alternatives especially since they are not mutually exclusive. It’s in fact a nice idea to combine pkgsrc and Homebrew to get the best of both worlds and access to even more packages.
Lastly, for a comprehensive searchable database of packages, please check the excellent pkgsrc.se.