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

15,637

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.

Share:
15,637

Related videos on Youtube

Remi.b
Author by

Remi.b

Updated on September 18, 2022

Comments

  • Remi.b
    Remi.b over 1 year

    I'd like to use the command line xdg-open. The command line is not known to my computer (Mac OSX) so I have to install the package (not sure this is the right term) that contains this command line. I think the package is called xdg-utils... I tried:

    brew install xdg-open
    brew install xgd-utils
    brew install xdg
    

    but it always returns something like

    Error: No available formula for xdg-utils 
    Searching formulae...
    Searching taps...
    
    • Moreaki
      Moreaki almost 9 years
      xdg-open is pretty neatly tied into the freedeskop environments, and OSX' counterpart would be the open command. Is there a specific use case where you absolutely need xdg-open? If so, give us more information, please.
    • Remi.b
      Remi.b almost 9 years
      THanks a lot for your comment. No there was no good reason for me to use xdg-open instead of open. I just didn't know the open command. Seeking in the manual I managed to do everything I needed to do with the open command line. Thanks a lot for your comment.
    • Remi.b
      Remi.b almost 9 years
      Your comment solved my problem but did not really answered the question. I now have no interest into using xdg-open on my machine. Do you want to make an answer out of your comment or do you want me to delete my post?