Deploying Script to M1 Laptop - Brew

pixitops
New Contributor

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

1 ACCEPTED SOLUTION

ewu-it
New Contributor III

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

 

Howard Griffith
Endpoint Systems Engineer
Eastern Washington University

View solution in original post

2 REPLIES 2

ewu-it
New Contributor III

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

 

Howard Griffith
Endpoint Systems Engineer
Eastern Washington University

View solution in original post

Up the eagles! This resolved the problem. Thank you so much.