The planned speaking for tonight's meeting of the Case Mac user group didn't show. I volunteered to talk about “pkgsrc on Mac OS X” and people seemed really interested, so I did.
Thanks for the impromptu opportunity to talk about one of my hobbies at the meeting tonight. Major points that I either did make or should have made:
- What's NetBSD?
NetBSD is a free version of Unix, directly descended from the original, with a history of excellent security and code quality. It runs on Macs, PCs, and four or five dozen other types of computers, including some really weird ones.
- What does this have to do with Mac OS X?
A great many of the Unix commands found in the OS X Terminal originated in NetBSD. To see for yourself — if you're feeling up to it — paste this command into Terminal:
strings `echo $PATH | sed -e 's|:|/* |g' -e 's|$|/*|'` | grep '$NetBSD' | sort | uniq | wc -l
You'll get a few unimportant warnings (ignore them) and then a number. This number tells you how many unique C source files from NetBSD were used to compile all the Unix programs in your shell's command path. The number of lines of NetBSD code, then, is probably at least two orders of magnitude higher.
If you use and like the Unix portion of OS X, try NetBSD!
- What's “pkgsrc”? (And how should I pronounce it?)
Compiling and installing third-party applications from source code has traditionally been an annoying but inevitable task for people who run Unix. The procedure is involved: find the software you want, download it, extract it, find and read the README (if there is one), figure out what all your options are, run a script with all those options, run a command to compile everything, run another command to install everything. If you're a careful sort of person, you'd also document everything you did. If you're not a careful sort of person, you're in trouble: most Unix applications lack an “uninstall” facility!
The people who work on NetBSD designed a framework called “pkgsrc” (pronounced “package source”, I hope) to simplify and automate every aspect of managing third-party Unix software. Originally intended for NetBSD only, it now supports several other Unix-like operating systems, including our beloved Mac OS X.
When you download and extract pkgsrc, you get a tree of Makefiles, one for each program pkgsrc knows how to manage. To install one from source code, change to its directory and type “make install” (you'll be prompted for the root password at install time). pkgsrc is also used to create binary packages: run “make package” instead. Official binary packages are published for each release of NetBSD. NetBSD 1.6.2 will be released in the next few weeks.
While binary packages can be fast and convenient, using pkgsrc to install from source gives you the chance to choose compile-time options other than the defaults. Also, anyone who has manually compiled more than a handful of third-party Unix programs will find it strangely enjoyable to see pkgsrc do all the hard work.
I'm a NetBSD and pkgsrc developer, and I helped port pkgsrc to OS X. That work was strangely enjoyable, too.
- As an OS X user, why should I try pkgsrc?
For Unix package management, your other main choices are Fink and DarwinPorts, both of which are specific to OS X. With pkgsrc, if you ever use another variant of Unix, you can take your package-management habits with you.
- As a Unix user, why should I try NetBSD?
There are many, many reasons. Much like the reasoning above, with NetBSD, if you ever use another type of computer, you can take your system-administration habits with you. Also, NetBSD is the primary development platform for pkgsrc. For more reasons:
- Where can I find more information?