Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
OSX update and upgrade package management : home-brew, rubygem, npm and so on
#!/bin/bash -
#title :upgrade-package-management.sh
#description :update and upgrade various package management and installed packages
#author :Franco Rondini
#date :20181223
#version :0.1-ALPHA-DO-NOT-USE-AS-IS-IN-PRODUCTION
#usage: comment out the package management that are not of your iterest and/or add the missing ones then launch the script in bash
#credits:
# - with reference to:
# - https://forum.shakacode.com/t/when-to-brew-update-and-brew-upgrade/350/3
# - https://github.com/Homebrew/homebrew-cask/blob/master/USAGE.md
#
# Get OS X Software Updates
alias update='sudo softwareupdate -i -a
# Installing Command Line Tools in Mac OS X
xcode-select --install
# Update and upgrade Homebrew
brew update
brew upgrade --all
# - optional check what's recently upgraded
# ls -lrt /usr/local/Cellar/
# upgrade Homebrew Cask
# - check for outdated Casks
brew cask outdated
# - install the outdated Casks
brew cask upgrade
# - optional check what's recently upgraded
# ls -lrt /usr/local/Caskroom/
brew cleanup
# very useful, when I had not heard of it before, for example I got:
# ==> This operation has freed approximately 12.5GB of disk space.
# Update and upgrade npm and their installed packages
# https://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo
sudo chown -R $(whoami) ~/.npm
sudo chown -R $(whoami) ~/.npm-packages
npm i -g npm
npm update -g
# Update installed Ruby gems
sudo gem update --system
sudo gem update
rbenv rehash
# Upgrade oh_my_zsh
upgrade_oh_my_zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.