Last active
January 15, 2022 14:26
-
-
Save solrevdev/59704b0249e401ac048a01231908d6e0 to your computer and use it in GitHub Desktop.
Uses the macupdater_client (https://www.corecode.io/macupdater/enterprise.html) and jq to update macOS app from the command line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
pc=$(hostname) | |
echo "macupdater 2 pro command line via $pc on $(date +"%Y-%m-%d %T")" | |
echo '--------------------------------------------------------------' | |
echo '' | |
echo '' | |
echo 'checking for prerequisites...' | |
echo '[] jq' | |
echo '[] /Applications/MacUpdater.app/Contents/Resources/macupdater_client' | |
if ! command -v jq &>/dev/null; then | |
echo 'jq could not be found' | |
echo 'please install jq from https://stedolan.github.io/jq/' | |
exit 1 | |
fi | |
macupdater_file=/Applications/MacUpdater.app/Contents/Resources/macupdater_client | |
if [ ! -f "$macupdater_file" ]; then | |
echo "$macupdater_file does not exist..please install macupdater_client via macupdater 2 website" | |
echo 'you can also alias macupdater_client to [/Applications/MacUpdater.app/Contents/Resources/macupdater_client]' | |
echo 'https://www.corecode.io/macupdater/enterprise.html' | |
exit 1 | |
fi | |
echo '' | |
echo '' | |
echo 'prerequisites complete:' | |
echo '[x] jq' | |
echo '[x] /Applications/MacUpdater.app/Contents/Resources/macupdater_client' | |
echo '' | |
echo 'now running macupdater_client to update all outdated apps that can be updated...' | |
outdated=$(/Applications/MacUpdater.app/Contents/Resources/macupdater_client list --hide-uptodate-apps --hide-mas-apps --hide-unsupported-apps --quiet --json | jq -r '.apps[] .installed_path') | |
if [ -z "$outdated" ]; then | |
echo 'no apps to update...' | |
echo 'done!' | |
else | |
echo "found apps to update..." | |
echo '' | |
while IFS= read -r app; do | |
echo "> updating $app" | |
echo " /Applications/MacUpdater.app/Contents/Resources/macupdater_client update --quiet $app" | |
/Applications/MacUpdater.app/Contents/Resources/macupdater_client update --quiet "$app" | |
done <<<"$outdated" | |
echo '' | |
echo 'done!' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Response back from Vitor from macupdater that does not need jq to be installed.