Skip to content

Pro Tips

BigMac Admin edited this page Nov 26, 2025 · 4 revisions

Overview

This page highlights some MDM agnostic tricks and pro tips for customizing Baseline.

If you'd like to submit your own Pro Tip for inclusion here, please open a Github Issue or reach out in the #Baseline channel of the Mac Admins Slack

Call a binary using the Scripts modules

In Baseline, anywhere you can define a ScriptPath you can instead provide the path to a binary, and then pass arguments using the AdditionalArguments key.

<dict>
	<key>Scripts</key>
	<array>
		<dict>
			<key>Arguments</key>
			<string>10</string>
			<key>AsUser</key>
			<false/>
			<key>DisplayName</key>
			<string>Sleep 10</string>
			<key>Icon</key>
			<string>SF=bed.double.circle,color=purple</string>
			<key>ScriptPath</key>
			<string>/bin/sleep</string>
			<key>Subtitle</key>
			<string>This script item just sleeps for 10 seconds. Useful for testing your Baseline DialogListOptions.</string>
		</dict>
	</array>
</dict>

This is useful for calling policies using the jamf binary, one-line scripts like using /usr/bin/touch to create a file, or any other reason you want Baseline to run a command-line application.

Zsh command substitution in your Dialog options

It is also possible to put command substitutions directly into your Baseline configuration profile.

Personalizing message contents with command substitution

Consider the following example of DialogListOptions which uses system_profiler to put the Serial Number in the --infobox section. We also can use a combination of system_profiler and dscl to welcome the user by name and add the device model name to the message.

	<key>DialogListOptions</key>
	<string>--infobox "Serial: $(/usr/sbin/system_profiler SPHardwareDataType | awk '/Serial Number/ {print $NF}')" --message "Welcome to your new $(system_profiler SPHardwareDataType | awk -F ': ' '/Model Name/ {print $2}'), **$(dscl . -read /Users/$(stat -f%Su /dev/console) RealName | tail -n1 | cut -d ' ' -f2)**"</string>
image

Automatically size the list window by a percentage of the screen height

In this example, we use system_profiler output in json format and pipe to jq to get the screen height in pixels. Then we use bc to do math and calculate 75% of the screen height and set the dialog height to that value. We also set --width to a set value of 950. This trick would only work on macOS 15+ due to the use of built in jq.

	<key>DialogListOptions</key>
	<string>--height $(echo "scale=0; $(system_profiler -json SPDisplaysDataType | jq -r '.SPDisplaysDataType.[].spdisplays_ndrvs.[0]._spdisplays_resolution' | cut -d ' ' -f3) * .75 / 1" | bc) --width 950</string>

image (This trick was submitted by an anonymous Mac Admin, thank you for making things better for everyone, friend.)

Clone this wiki locally