Skip to content

Instantly share code, notes, and snippets.

@atomicstack
Created March 27, 2022 07:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atomicstack/7a3d6c85758119cb5b30f040173eaec4 to your computer and use it in GitHub Desktop.
Save atomicstack/7a3d6c85758119cb5b30f040173eaec4 to your computer and use it in GitHub Desktop.
zsh function to display the install path for a given brew package
function brew-active-path() {
brew info "$1" | perl -naE 'm/[*]$/ and say($F[0])'
}
@atomicstack
Copy link
Author

atomicstack commented Mar 27, 2022

$ uname -m
x86_64

$ brew-active-path nvim  
/usr/local/Cellar/neovim/0.6.1

$ brew-active-path tmux  
/usr/local/Cellar/tmux/HEAD-d26a4ea_1
$ uname -m
arm64

$ brew info nvim | perl -naE 'm/[*]$/ and say($F[0])'
/opt/homebrew/Cellar/neovim/0.6.1

$ brew info tmux | perl -naE 'm/[*]$/ and say($F[0])'
/opt/homebrew/Cellar/tmux/HEAD-d26a4ea_1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment