1. 6
    1. 6

      My favorite advanced (and lesser-known?) feature of Homebrew is the ability to write your own external commands. (I believe they got the idea from Git, which has the same feature.)

      In a nutshell, you write a new command in Ruby or any language that supports a shebang, name it brew-mycommand.rb (if it’s in Ruby) or brew-mycommand (if it’s in any other language), make the file executable and put it somewhere in your $PATH, and then you can call it as brew mycommand, just as if it were an internal command from Homebrew itself. (As the Homebrew docs explain, you can even easily produce --help output using Homebrew’s internal --help system.)

      One other note: as I recall, an advantage of using Ruby rather than Python, bash, or whatever else is that you can use features from Homebrew itself in your command. (I suppose that’s an advantage and a disadvantage since Homebrew may change its API out from under your command.)

      1. 2

        I actually didn’t knew about this thanks for sharing this