Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Apple unique workstation UUID.
UUID=$(/usr/sbin/ioreg -rd1 -c IOPlatformExpertDevice | /usr/bin/perl -ne 'if (m/^.*\"IOPlatformUUID\" = \"(.*).*\"$/im) {print $1}')
# Mac address.
MACADDRESS=$(/usr/sbin/networksetup -getMACADDRESS en0 | /usr/bin/awk '{print $3}' | /usr/bin/sed s/://g)
#* Default preferences.
#+ Modifies /System/Library/User Template
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AutoFillCreditCardData</key>
<false/>
<key>AutoFillFromAddressBook</key>
<false/>
<key>AutoFillPasswords</key>
<false/>
@apizz
apizz / DownloadAppleSecurityUpdate.sh
Created March 13, 2018 23:06
Download Apple Security Update
#!/bin/bash
# Must match the update name exactly as it appears in the `softwareupdate -l` listing
PATCH_TO_MATCH="$4"
# Security Product ID number - number of the folder in /Library/Updates with contained updates
SEC_PROD_KEY="$5"
# Defined minimum allowed free space % in order to download the update
MINPERCENTFREE="$6"
# Available space of boot volume /
AVAILSPACE=$(/bin/df / | /usr/bin/tail -1 | /usr/bin/awk '{print $4}')
@apizz
apizz / InstallAppleSecurityUpdate.sh
Created March 13, 2018 23:18
Install Apple Security Update
#!/bin/bash
# Variable must match the name exactly as it appears in the `softwareupdate -l` listing
PATCH_TO_MATCH="$4"
# Security Product Key number - AKA /Library/Updates directory with contained updates
SEC_PROD_KEY="$5"
# Defined maximum % of used space allowed in order to download the update
MINPERCENTFREE="$6"
# Custom trigger of DownloadSecurityPatch.sh script policy
CUSTOMTRIGGER="$7"
#!/bin/bash
#####
# OSX Machine auth for 802.1x profile
# get AD machine user/pass and put into 802.1x profile template
# install the profile
#
# sed has it's own uses for '&' and '\' in replacements
# and the randomly generated password sometimes has them
# So, trap and escape them before feeding into sed
#
@apizz
apizz / com.yourorg.reposado-reposync.plist
Last active May 17, 2018 12:18
LaunchDaemon to trigger a repo_sync for the sphen/reposado Docker container every day at 5am
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.yourorg.reposado-reposync</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/docker</string>
<string>exec</string>
@apizz
apizz / RunManagedAppleSoftwareUpdate.sh
Last active June 8, 2018 04:12
Run managed Apple software update download & install with munki
#!/bin/sh
MUNKI="/usr/local/munki/managedsoftwareupdate"
MUNKI_CACHE=$($MUNKI --show-config | /usr/bin/awk -F "'" '/ManagedInstallDir/{print $2}')
APPLESU_FILE="${MUNKI_CACHE}AppleUpdates.plist"
# Verify munki is installed
if [ ! -f "$MUNKI" ]; then
/bin/echo "Munki not installed. Exiting."
exit 1
@apizz
apizz / Uninstall_Wacom_Drivers.sh
Created December 6, 2018 21:33
For uninstalling Wacom driver software before installing a newer version
#!/bin/sh
OLD_APP="/Applications/Pen Tablet.localized/Pen Tablet Utility.app"
APP="/Applications/Wacom Tablet.localized/Wacom Tablet Utility.app"
OLD_EXE="${OLD_APP}/Contents/Resources/uninstall.pl"
EXE="${APP}/Contents/MacOS/Wacom Tablet Utility"
# If this app is installing, munki has detected we have a newer version. Therefore, if Wacom Tablet Utility already exists then we need to uninstall first
if [ -d "$OLD_APP" ]; then
sudo "$OLD_EXE"
@apizz
apizz / EA_Clear_Failed_MDM_Commands.sh
Last active May 17, 2023 20:08
Jamf extension attribute for checking for and removing any failed macOS MDM commands
#!/bin/bash
jssurl="https://yourjss.com"
apiuser="yourapiuser"
apipass="yourapiuserpass"
serial=$(/usr/sbin/ioreg -rd1 -c IOPlatformExpertDevice | /usr/bin/awk -F'"' '/IOPlatformSerialNumber/{print $4}')
####### FUNCTIONS
clearfailedmdmcommands () {
@apizz
apizz / com.google.Chrome.plist
Created January 15, 2019 00:24
Template /Library/Preferences.com.google.Chrome.plist file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BookmarkBarEnabled</key>
<true/>
<key>HomepageIsNewTabPage</key>
<false/>
<key>HomepageLocation</key>
<string>https://yourhomepage.com</string>