Posted on 10-06-2022 04:33 AM
I'm curious if anyone has an extension attribute or script to detect the presence of homebrew anywhere on a device(not just the default install location)?
Thanks for any help!
Posted on 10-07-2022 05:02 AM
This is what we use
#!/bin/bash
if [ ! -z $(which brew) ];then
echo "<result>Yes</result>"
else
echo "<result>No</result>"
fi
exit 0
Posted on 10-07-2022 05:22 AM
Thanks @ssoun I actually posed this same question over in the scripting channel of mac admins slack yesterday and had someone respond with the below, which seems to be working well in our environment:
#!/bin/sh
crntusr="$(/usr/bin/stat -f %Su /dev/console)"
brewchk="$(/usr/bin/sudo -i -u "$crntusr" /usr/bin/which brew)"
if [ -z "$brewchk" ]
then
echo "<result>no</result>"
else
echo "<result>$brewchk</result>"
fi
Posted on 10-07-2022 06:57 AM
Cool, the EA even returns where brew is installed.
Posted on 12-06-2023 03:33 AM
Curious if this is still working?
I'm getting blank returns from the brewchk variable when running through Jamf.
Brew is installed and the path is found in the user's $PATH