Brew Deployment (macOS 2023)
Description
Like to instal Brew on a macOS device. This is just the place.
Actually, not just Brew, but:
- Apple Command Line Tools
- Brew
- Cask
Ingredients
-
FileWave Central
-
Attached Fileset
macOS Brew Fileset |
Directions
- Unzip the download and drag the Fileset into the FileWave Central > Filesets view, into a Fileset group of choice.
- Associate with a test device and Update Model
- After all is well with the test, consider expanding this to a larger quantity of devices
Activation Script
Apple Command Line tools are a requirement and will be installed first. Upon completion, not only will Brew instal, but the Fileset will double check there are no further updates and if so, those shall also be installed.
The Activation Script will use the newest version of the Command Line tools found, when ran. It is possible to overrule this behaviour by supplying a desired version as a Launch Argument.
Post Activation Script
The Fileset will attempt to instal Brew with the currently logged in user. If this user is does not have an ID greater than 501, the script will attempt to instal with an Admin user on the device. The script log should report the user that was configured for Brew. Consider altering the script if a different behaviour is desired.
This user shall also be added to the macOS developer group.
Below is the section of script that defines the user and also adds that user to the development group:
current_user=$(stat -f%Su /dev/console)
# ....
# If user is below uid 500 should we abort or pick a user. Picking an admin user for now
if [ $(id -u $current_user) -lt 501 ]
then
echo "No 500 user. Picking a local admin user"
current_user=$(/usr/bin/dscl . -read /Groups/admin GroupMembership | awk '{print $NF}')
fi
echo "Configuring user ${current_user}..."
# Add them as a developer
is_developer=$(groups $current_user | awk '/ _developer / ')
if [ ! $is_developer ]
then
echo "Adding user $current_user to _developer group"
/usr/sbin/dseditgroup -o edit -a "$current_user" -t user _developer
fi