1

I can open the homepage for a Homebrew formula by running the following command-line:

brew home <formula>

and for a Homebrew Cask by running the following command-line:

brew cask home <cask>

However, running the above command-lines immediately open the homepage in the default Web-browser.

Is there a way (preferably via command-line) to only display the homepage for a formula or cask without opening it in a Web-browser?

Additionally, is there a way to configure the command-line such so as to open the link in a specific Web-browser?

1

The homepage URL is a part of the output of brew info FORMULA, so you can run:

brew info FORMULA | grep -E '^https?:'

to extract just the link to the homepage. This also allows to run:

open -a Firefox.app "$(brew info FORMULA | grep -E '^https?:')"

to open the link in Firefox.app.

The respective command-lines for Homebrew Cask are:

brew cask info CASK | grep -E '^https?:'

and

open -a Firefox.app "$(brew cask info CASK | grep -E '^https?:')"
3
  • @NimeshNeema Not sure it needs -E here, works without as well. – nohillside May 20 '20 at 11:01
  • That's really strange. I originally tried without -E but it didn't appear to work. I read though the man page and tried adding support for extended regular expression and it worked. I am using the Apple installed grep in macOS 10.15.4 with version grep (BSD grep) 2.5.1-FreeBSD. Additionally, I also have Xcode Command Line Tools installed. – Nimesh Neema May 20 '20 at 11:24
  • I stand corrected, thanks for spotting this. So much for making a "small" change when copying the working solution from Terminal into the browser... – nohillside May 20 '20 at 11:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .