|
|
Use the pkgsrc packages collection on Mac OS XFrom ezUnix
IntroductionOn Mac OS X, you either compile programs by yourself, or you use MacPorts or Fink. If you only have the need to compile a few basic things then maybe you’re fine, but with some packages things pretty much get messy quickly as you have to hunt around for dependencies and stuff. So, there is one option that isn’t quite popular as the previous two mentioned. It’s called pkgsrc and it is quite nice—actually, I am using it with great success. NetBSD is known as the highly portable operating system and pkgsrc is no exception. Given that this is OS X, we will pay special attention to install pkgsrc in an isolated environment that OS X will never ever touch. pkgsrc requires case-sensitive file system and OS X by default uses HFS+ which is case-insensitive. We will use a sparse disk image and therefore get rid of the limitations while also gaining much benefits. IMHO, this is the most portable, cleanest and best way to use the pkgsrc on Mac OS X. When you unmount the disk image, there is no single trace of pkgsrc on the system except the symlinks and the PATH variable. You can even put it on the flash disk and use it on various computers! When it’s unmounted, Mac OS X doesn’t care. And when it’s mounted you instantly have all your tools at your disposal. Pretty neat.
PrerequisitesFirst things first, you will need Apple Developers Tools installed.
SetupEdit your .bash_profile/.bash_login/.bashrc or whatever you use to include this: export CVSROOT=anoncvs@anoncvs3.de.netbsd.org:/cvsroot export CVS_RSH=ssh export PATH=/usr/pkg/bin:/usr/pkg/sbin:$PATH export MANPATH=/usr/pkg/man:$MANPATH And .cvsrc: # recommended CVS configuration file from the pkgsrc guide checkout -P update -dP release -d diff -upN cvs -q -z3 rdiff -u
Apply the changes made to profile. ~/.bash_profile
Create the sparse disk image# hdiutil create -fs HFSX -fsargs "-c c=64,a=16,e=16 -s" -volname pkgsrc -type SPARSE -stretch SizeOfYourDisk -size SizeOfYourDisk -ov /SomewhereOnYourDisk/pkgsrc
Mount itMount the image by double clicking it in the Finder.
Create some folders in it# cd /Volumes/pkgsrc # mkdir pkg pkgsrc pkgdb
Create symlinks# sudo ln -s /Volumes/pkgsrc/pkg /usr/pkg # sudo ln -s /Volumes/pkgsrc/pkgsrc /usr/pkgsrc # sudo ln -s /Volumes/pkgsrc/pkgdb /var/db/pkg
Checking out the treeWe will now checkout the pkgsrc: # cd /usr # cvs -q co -P pkgsrc
Bootstrap# cd pkgsrc/bootstrap # sudo ./bootstrap
Install new packageTo actually install something from the pkgsrc package collection, do the following: # cd /usr/pkgsrc/misc/figlet #bmake install clean clean-depends
Misc InfoCompact the disk imageYou can later optimize the disk image to use less space by issuing the following command (you must first unmount the disk image): # hdiutil compact /SomewhereOnYourDisk/pkgsrc.sparseimage
CVS mirrorsYou can use any of the NetBSD AnonCVS mirrors listed here: http://www.netbsd.org/mirrors/#anoncvs.
# export CVSROOT=anoncvs@anoncvs.fr.NetBSD.org:/pub/NetBSD-CVS
wgetTo use for example wget instead of ftp when installing packages, first you need to install it like before by going to net/wget folder and issuing the make commands and then modifying the /usr/pkg/etc/mk.conf file to include the following before the last line: FETCH_CMD= wget FETCH_BEFORE_ARGS= --passive-ftp FETCH_RESUME_ARGS= -c FETCH_OUTPUT_ARGS= -O
bmakeThis is important: You must use the bmake command instead of make on Mac OS X when installing packages.
VulnerabilitiesTo download the vulnerability list, run the following: # download-vulnerability-list
Cleaning the build directoriesIf you sometimes forget to clean or simply need the build directories, you can delete them later like this: # find /usr/pkgsrc -name work -exec rm -r {} \;
Or install the pkgclean package
LinksThe original aricle
nmt said ...<comment date="2012-11-26T02:43:15Z" name="nmt"> If you download Xcode 4.3 or later, the command line tools are not available by default. See https:developer.apple.com/support/xcode/ for details on how to download the command line tools. </comment> |