Posted on 09-15-2021 07:58 AM
Hi,
I'm running a script from Jamf that pulls a gitlab repo then executes a script from said repo that installs some packages leveraging brew install. The script works nicely on the intel laptop but not on M1
The error showing in Jamf should the script executed other parts of the script but fails when calling brew.
install.sh: line 10: brew: command not found
If I run sh install.sh locally via terminal it works well. If I run brew in either bash to zsh it finds the command.
What could be occuring differently when executing the script via Jamf Self Service that means it's completely oblivious to the brew installation?
Jamf Script Snippet
#!usr/bin/env bash
#Get loggedInUser name
loggedInUser=$( scutil <<< "show State:/Users/ConsoleUser" | awk '/Name 😕 && ! /loginwindow/ { print $3 }' )
#Execute script under loggedInUser
#sudo -u "$loggedInUser" ~/devtools/install.sh
#!usr/bin/env bash
############################
# installs homebrew packages
# installs homebrew cask packages
# adds AWS login scripts to .bash_profile
# sets terminal to launch ssh-agent on launch
############################
## Install Brew Packages
brew install asdf
brew install awscli
## Install Brew Cask Packages
brew install --cask iterm2
brew install --cask docker
Any advice would be gratefully received!
Mac OS 11.5.2 M1
Solved! Go to Solution.
Posted on 09-17-2021 09:50 AM
It looks like the path for brew on m1s is not part of the global environment path variable where the machine looks for it. Try altering the script like this:
#!usr/bin/env bash
############################
# installs homebrew packages
# installs homebrew cask packages
# adds AWS login scripts to .bash_profile
# sets terminal to launch ssh-agent on launch
############################
## Install Brew Packages
/opt/homebrew/bin/brew install asdf
/opt/homebrew/bin/brew install awscli
## Install Brew Cask Packages
/opt/homebrew/bin/brew install --cask iterm2
/opt/homebrew/bin/brew install --cask docker
Posted on 09-17-2021 09:50 AM
It looks like the path for brew on m1s is not part of the global environment path variable where the machine looks for it. Try altering the script like this:
#!usr/bin/env bash
############################
# installs homebrew packages
# installs homebrew cask packages
# adds AWS login scripts to .bash_profile
# sets terminal to launch ssh-agent on launch
############################
## Install Brew Packages
/opt/homebrew/bin/brew install asdf
/opt/homebrew/bin/brew install awscli
## Install Brew Cask Packages
/opt/homebrew/bin/brew install --cask iterm2
/opt/homebrew/bin/brew install --cask docker
Posted on 09-18-2021 03:47 AM
Up the eagles! This resolved the problem. Thank you so much.
Posted on 01-10-2023 12:06 PM
Got this error after running the above mentioned command:
"Script result: Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all build scripts full access to your system."