Created
July 25, 2017 18:35
-
-
Save loop/f994057d6dee5ba0d33ae7278482e97d to your computer and use it in GitHub Desktop.
whatsnew
This file contains 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
#!/bin/sh | |
# up - script to keep your Mac up-to-date (both OS and Homebrew updates) via the command line | |
# run thus to to install: cd /usr/local/bin && curl -s -O https://gist.githubusercontent.com/mayel/e681a6175bf17366a16e03006d7feac2/raw/bb4ddb0c4842f5633fa1f29df61c433760c4affe/up && chmod 755 /usr/local/bin/up | |
# and then run it anytime by simply entering the command: up | |
# By https://github.com/mayel based on a script by https://github.com/imwally | |
# homebrew | |
echo "Checking homebrew packages..." | |
brew update > /dev/null; | |
new_packages=$(brew outdated --quiet) | |
num_packages=$(echo $new_packages | wc -w) | |
if [ $num_packages -gt 0 ]; then | |
echo "\n$num_packages New brew updates available:" | |
for package in $new_packages; do | |
echo " * $package"; | |
done | |
echo "\nInstall brew updates? (y/n)" | |
read answer | |
if echo "$answer" | grep -iq "^y" ; then | |
brew upgrade && echo "\nBrew updates done!" | |
fi | |
echo "\nClean up old versions of brew packages? (y/n)" | |
read answer | |
if echo "$answer" | grep -iq "^y" ; then | |
brew cleanup && echo "\nBrew cleanup done!" | |
fi | |
else | |
echo "\nNo brew updates available." | |
fi | |
# macOS | |
echo "\nChecking macOS updates..." | |
softwareupdate -l | tail +5 | |
echo "\nInstall macOS updates? (y/n)" | |
read answer | |
if echo "$answer" | grep -iq "^y" ; then | |
sudo softwareupdate -i -a && echo "\nmacOS updates done! You may need to reboot..." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cd /usr/local/bin &&
curl -s -O https://gist.githubusercontent.com/loop/f994057d6dee5ba0d33ae7278482e97d/raw/6967024b0fea3ab8737872701324cdb5c2fa62d6/whatsnew &&
chmod 755 /usr/local/bin/whatsnew