FreeBSD: HOWTO install vim from ports WITHOUT X-Windows.

I’m normally a manually-compile-from-source type of guy, but I thought I’d give FreeBSD’s ports system a try. Right away I ran into an annoyance, and something that underscores a constant battle: trading customizability for ease-of-use. Yes, ports makes installing things easier, but you lose a certain level of control and customizability.

Installing vim from ports seems easy enough, right? Sure, if you want tons of bloat included! A simple make; make install in /usr/ports/editors/vim started a flurry of downloads for things like X11toolkits, X11R6.8.2, etc, etc.. in other words, installing vim from ports was trying to also install X-Windows on my machine!! This is a server, I do NOT need the bloat of X-Windows simply to run a frickin’ text editor like vim.

So, after some research, I discovered that you can in fact control port installs with various arguments. Here’s how I installed vim:
cd /usr/ports/editors/vim
make WITHOUT_X11=yes
make WITHOUT_X11=yes install

PRESTO, a nice, clean, bloat-free, non-X-Windows install of vim. As a general tip, you can look inside the port’s Makefile to see various arguments that you can pass in.

A caveat though, if you ever upgrade all your ports with portupgrade, all of your ports will upgrade with the default arguments. So if I ran portupgrade and a new version of vim was available, it would install vim and all the X-Windows crap along with it.

Luckily, FreeBSD provides a way to automatically provide arguments to auto-upgrades via portupgrade: Simply open up /usr/local/etc/pkgtools.conf and fill in the MAKE_ARGS tag like so:
'editors/vim' => 'WITHOUT_X11=YES',

Now the next time you upgrade vim using portupgrade, the WITHOUT_X11 argument will be automatically included, so you won’t have to worry about all that extra X11 crap being included in your install.