Archive for May, 2011

Changing Your User ID in Mac OS X

Thursday, May 19th, 2011

Due to the nature of my personal, professional and (up until recently) academic lives, I routinely found myself interacting with all three major operating systems on a daily basis (hooray for virtualization). However, keeping my data in sync between my Windows, Linux, and Mac virtual machines was always an exercise in frustration for me, so a few years ago, I got fed up and finally decided to migrate all my files over to a shared directory on my server and access everything remotely.

This has worked out incredibly well, and I recommend it to anybody who uses more than one machine on a daily basis. I enjoy the luxury of having immediate access to my files from all three virtual machines at the same time.

File ownership and file permissions can be tricky though. For example, if I use NFS to create a directory on my server using my Mac OS X VM, I’ll have trouble writing to that directory from my Debian Linux VM since the UID of the Mac OS X user won’t match the UID of the Debian user. This is due to the fact that Mac OS X starts incrementing UIDs at 500, while Debian starts at 1000.

Note: Humorously enough, this problem doesn’t affect Windows since Windows uses SMB, and Samba handles file permissions in a different way than NFS. The trade-off though is speed: NFS is traditionally faster than SMB, but I digress.

Since Debian isn’t alone in this kind of behavior (indeed, almost every major Linux distribution and all major BSD derivatives start UIDs at 1000), it seems only natural to bring Mac OS X in line with the rest of the group rather than try to change every future Linux or BSD derivative I’ll use.

Installing vim on FreeBSD without the X Window System

Thursday, May 12th, 2011

I have absolutely no idea why a command line text editor would ever need a component from a GUI system, but as I recently discovered, trying to install Vim on FreeBSD from the ports collection will also install a whole host of X Windows System related packages that you may not be interested in.

Since the particular machine I’m working on will be a headless media server stashed in an attic somewhere, and maintained only with a terminal and SSH, I wasn’t interested in having any GUI packages installed.

To install Vim without the X Windows System, I took a look inside Vim’s Makefile and found an argument that seemed to do the trick:

# cd /usr/ports/editors/vim
# make WITHOUT_X11=yes
# make WITHOUT_X11=yes install

The rest of the installation went off without a hitch, and I now have a full install of Vim running without all the extra X11 packages taking up space on my server’s drive.

Note: If you ever use portupgrade, keep in mind that unless you specifically instruct it to do otherwise, portupgrade will assume you want to update your system with each port’s original/default install options. This means that if a new version of Vim was released, and you wanted to autoupdate your system with a single portupgrade command, you’d end up downloading, compiling, and installing all the X Windows System packages right along side the new version of Vim.

Fortunately, FreeBSD includes a way to tell portupgrade to preserve your original compile arguments, which can be found at /usr/local/etc/pkgtools.conf.

Add the following excerpt to your pkgtools.conf file, and you’ll be good to go for all future updates:

'editors/vim' => 'WITHOUT_X11=YES',