Published on

Getting Mac Style Command Line Tools to Work on Ubuntu

Authors

I have been using Mac professionally for the last 5 or so years of my career. While Ubuntu is awesome there are a few things I miss from my Mac dev workflow:

  • open command: I loved being able to type open fileName or open . to open a file with the appropriate program or in Finder respectively
  • pbcopy: lets you easily pipe the output of a command to the clipboard
  • cdf alias. See this article but basically what this does is tell's Finder to switch to the current terminal directory
  • brew: Homebrew makes life so much easier being able to generally brew install or brew cask install most things. Obviously, there is apt on Ubuntu, but it is still not as polished as Homebrew.

Open Command

This question goes into setting this up. But in a nutshell, you simply set up an alias to xdg-open in your rc file:

alias open='xdg-open &>/dev/null'

The above pipes all output to /dev/null so you do not see it after running open. The main caveat with this is you will also not see any errors that may have happened when you called open.

PBcopy

This question goes into this setup. You need to install either xsel or xclip. I chose to go with xsel as the api seems simpller to use. To install it:

sudo apt install xsel

Then add the following to your rc:

alias copy='xsel -ib'

CDF

I have not worked out how to get this to work yet. Once/if I do I will update this section.

Brew

This can be installed as detailed here. It does not work as nicely on Mac but it still works pretty well.