How do I use xdg-open from xdg-utils on Mac OSX?

xdg-open is pretty neatly tied into the freedeskop environments, and OSX' counterpart would be the open command.

If, for whatever reason, you still like to try out xdg-open on OSX, here is how you get it installed manually:

brew install libxslt xmlto # and potentially other packages like the GNU autotools/install suite
export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"
git clone git://anongit.freedesktop.org/xdg/xdg-utils
cd xdg-utils
./configure --prefix=/usr/local
make
make install

This will install the respective tools into /usr/local/bin, where the rest of the brew commands reside. Now, unless you install XQuartz, the usage of the xdg-utils is very limited. So:

brew cask install xquartz

And then you need to configure your X11 applications to be xdg agnostic. Not sure how to make OSX commands xdg agnostic. Probably by fiddling around with the xdg-mime.