Skip to content

Instantly share code, notes, and snippets.

@RedenticDev
Last active February 6, 2021 13:03
Show Gist options
  • Save RedenticDev/3a6af4e838ad2137b2471b6b0bf5b4df to your computer and use it in GitHub Desktop.
Save RedenticDev/3a6af4e838ad2137b2471b6b0bf5b4df to your computer and use it in GitHub Desktop.
Update your Mac with one command
# Put this function in your .bashrc/.zshrc (recommended)
# You can rename it as you want. Don't forget to relaunch your Terminal to apply changes. Simply run it with `update`.
# You can adapt it depending on what you've installed in your system.
function update {
# Homebrew
printf "\e[1;36m>> Homebrew\e[0m\n"
brew update; brew upgrade; brew upgrade --cask --greedy
# OPTIONAL LINES
hls=$(ls $HOME/Library/Caches/Homebrew)
total=$(echo "$hls" | wc -l | xargs)
big_sur=$(echo "$hls" | grep -c big_sur)
cata=$(echo "$hls" | grep -c catalina)
others=$(echo "$hls" | grep -v big_sur | grep -v catalina | wc -l | xargs)
printf "\n\e[1mHomebrew packages summary:\e[0m\nTotal: $total\tBig Sur: $big_sur\tCatalina: $cata\tOthers: $others\n"
# END OF OPTIONAL LINES
# Python
printf "\n\e[1;36m>> Python PIP\e[0m\n"
python3 -m pip list --outdated --format=freeze | grep -v '^\-e' | cut -d'=' -f1 | xargs -n1 python3 -m pip install -U
# Ruby
printf "\n\e[1;36m>> Ruby Gems\e[0m\n"
gem update
# Theos
printf "\n\e[1;36m>> Theos\e[0m\n"
$THEOS/bin/update-theos
# macOS
printf "\n\e[1;36m>> macOS Updates\e[0m\n"
softwareupdate -l -i -a
# Mac App Store, requires mas (`brew install mas`)
printf "\n\e[1;36m>> App Store\e[0m\n"
mas outdated
mas upgrade
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment