Porting Command Line UNIX Tools to Mac OS X

This article is an interesting discussion of how Mac OS X differs from other Unices and what some of the considerations are when porting Unix software to Mac OS X.

Some snippets of interest:

  • dlopen, dlsym, dlclose, etc. not supported; there are some ugly Mac-specific alternatives. I thought I had heard that Mac had implementations of those functions written in terms of the Mac-specific ones. I don’t know if that was wrong or maybe this document is old.
  • Mac OS X has a different mechanism for shared libraries and a different linker
  • No ldd; use otool -L instead.

Porting Command Line UNIX Tools to Mac OS X

Playing with Gentoo

Just for the heck of it, I setup a virtual machine with QEMU and installed Gentoo Linux in it. Gentoo is the distro for uberhackers – no fancy installers here; you do all the setup manually and you compile everything yourself (including the kernel) so you decide exactly what’s included and what’s not and what compile options to use. Thus, it’s an ideal distro if you’re trying to make a really lean and mean install. Packages come from a FreeBSD-inspired packaging system called Portage and you use an intuitive Python-based tool called emerge to install packages. Packages are downloaded as source code and compiled on your local system, which is either fantastic or a pain in the butt, depending on your perspective.

For me, it’s a bit of a pain to do all of that stuff manually when there are great distros like Ubuntu that make some compromises but get you a well-performing install with a great desktop and a minimum of effort.

Folder View: Windows freeware for faster access to folders

From the Folder View web site

Folder View is a free (freeware) add-on for Windows that drastically enhances the way you browse the folders on your system.

Files are often scattered around many different folders on the harddisk and locations on the network. Every time you want to copy, move, open or save a file, this situation leads you to a quest through levels of folders.

With Folder View, these quests are over. Folder View enhances the Windows file Explorer by making all folders you need available in a single click. It integrates with other applications, speeding up opening and saving of files and also lets you copy and move files very quickly.

What’s up with REQUEST_FILENAME in mod_rewrite?

I was trying to setup mod_rewrite rules for a CakePHP app running under Apache.

According to the mod_rewrite docs, REQUEST_FILENAME is “The full local filesystem path to the file or script matching the request.”

If that were true, this idiom, which I’ve seen in a number of places,
should work to prevent the RewriteRule underneath it from firing when a request is made for a file which exists in the filesystem:

RewriteCond %{REQUEST_FILENAME} !-f

But it doesn’t. Looking at the rewrite log reveals that REQUEST_FILENAME, on my system at least, is not the full filesystem path; it is actually relative to the document root. Which means that the condition is never true and the rewrite will always happen.

So in order to get it to work, I have to do this ugly hack:

RewriteCond /home/y/share/htdocs%{REQUEST_FILENAME} !-f

Why?