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!
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!
This is what we use
#!/bin/bash
if [ ! -z $(which brew) ];then
echo "<result>Yes</result>"
else
echo "<result>No</result>"
fi
exit 0
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
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
Cool, the EA even returns where brew is installed.
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
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.