Posted on 08-09-2023 06:21 AM
Hi Everyone,
How can I get the list of apps installed with Brew? I could not pull this list with Jamf Pro via script. Because the brew list command should work in the corresponding profile. However, I guess Jamf Pro doesn't run it in the relevant profile. Is there a practical method? I used the following commands;
brew list --cask
brew list
Solved! Go to Solution.
08-09-2023 08:33 AM - edited 08-09-2023 08:40 AM
my bad... copy paste.. let me down.. missing " on line 3
su -l "$consoleuser" -c "${HOMEBREW_PREFIX}/bin/brew list -cask"
which brew
in terminal will give you install path.. to confirm / update
Posted on 08-09-2023 11:07 AM
we use this EA to get that info as there is a path difference between ARM64 and X86. see if it helps. results modified so you may need to work on the spacing. Please test on a non-production device
#!/bin/sh
# base result
RESULT="Not Found"
# Find machine type
UNAME_MACHINE="$(uname -m)"
cliapps=$(ls /usr/local/bin)
if [[ "$UNAME_MACHINE" == "arm64" ]]; then
# M1/arm64 machines
if [[ -e /opt/homebrew/bin/brew ]]; then
brewinstm1=$(ls /opt/homebrew/Caskroom)
brewinstm1celler=$(ls /opt/homebrew/Cellar)
fi
else
# Intel machines
if [[ -e /usr/local/bin/brew ]]; then
brewinsti1=$(ls /opt/homebrew/Caskroom)
brewinsti1celler=$(ls /opt/homebrew/Cellar)
fi
fi
echo "<result> CLI Installed Software: $cliapps: BREW M1 Installed software $brewinstm1 $brewinstm1celler BREW Installed Software Intel: $brewinsti1 $brewinsti1celler </result>"
Posted on 08-09-2023 08:01 AM
shamelessly taken from Brew install script.. but this should run in user context.. NOT tested.. and could prob be written better..
consoleuser=$(scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
HOMEBREW_PREFIX="/usr/local"
su -l "$consoleuser" -c "${HOMEBREW_PREFIX}/bin/brew list -cask
Posted on 08-09-2023 08:11 AM
Hi,
I got an error like this. Do you have an idea?
Script result: /Library/Application Support/JAMF/tmp/Brew List: line 3: unexpected EOF while looking for matching `"'
/Library/Application Support/JAMF/tmp/Brew List: line 4: syntax error: unexpected end of file
08-09-2023 08:33 AM - edited 08-09-2023 08:40 AM
my bad... copy paste.. let me down.. missing " on line 3
su -l "$consoleuser" -c "${HOMEBREW_PREFIX}/bin/brew list -cask"
which brew
in terminal will give you install path.. to confirm / update
Posted on 08-09-2023 08:31 AM
Hi,
I think the path information is much different than that. I have to write the correct one.
Posted on 08-09-2023 11:07 AM
we use this EA to get that info as there is a path difference between ARM64 and X86. see if it helps. results modified so you may need to work on the spacing. Please test on a non-production device
#!/bin/sh
# base result
RESULT="Not Found"
# Find machine type
UNAME_MACHINE="$(uname -m)"
cliapps=$(ls /usr/local/bin)
if [[ "$UNAME_MACHINE" == "arm64" ]]; then
# M1/arm64 machines
if [[ -e /opt/homebrew/bin/brew ]]; then
brewinstm1=$(ls /opt/homebrew/Caskroom)
brewinstm1celler=$(ls /opt/homebrew/Cellar)
fi
else
# Intel machines
if [[ -e /usr/local/bin/brew ]]; then
brewinsti1=$(ls /opt/homebrew/Caskroom)
brewinsti1celler=$(ls /opt/homebrew/Cellar)
fi
fi
echo "<result> CLI Installed Software: $cliapps: BREW M1 Installed software $brewinstm1 $brewinstm1celler BREW Installed Software Intel: $brewinsti1 $brewinsti1celler </result>"