Skip to main content
Question

List of All Brew Casks

  • September 2, 2022
  • 1 reply
  • 6 views

RickyFH
Forum|alt.badge.img+2

Hello Everyone,

Does anyone have a method of using an extension attribute to get a list of all casks and formulae installed in our environment?

1 reply

tdclark
Forum|alt.badge.img+19
  • Contributor
  • 51 replies
  • September 2, 2022

I am using an EA to pseudo-track this.  It's not perfect, but it meets what our InfoSec team wants to know.

#!/bin/sh loggedInUser=$(stat -f %Su /dev/console) arch=$(/usr/bin/arch) brewPath="" if [ "$arch" == "arm64" ]; then brewPath="/opt/homebrew/bin/brew" else brewPath="/usr/local/bin/brew" fi if [ -e "${brewPath}" ] then brewed=$(sudo -u "${loggedInUser}" "${brewPath}" list) else brewed="Nothing Installed" fi echo "<result>$brewed</result>" exit 0