Skip to content

Instantly share code, notes, and snippets.

@T1T4N
Last active January 9, 2018 08:41
Show Gist options
  • Save T1T4N/913f8dcc7ca69536a96c572f12e3d377 to your computer and use it in GitHub Desktop.
Save T1T4N/913f8dcc7ca69536a96c572f12e3d377 to your computer and use it in GitHub Desktop.
brew update all packages by temporary unpinning
# cd /usr/local/Homebrew
# brew update && git stash pop
# BREW_PINNED=$(brew list --pinned | sort | tr '\n' ' ') sh -c '_cleanup() { brew cleanup && brew cask cleanup && brew pin $BREW_PINNED; }; trap _cleanup INT; echo "Pinned: $BREW_PINNED"; brew unpin $BREW_PINNED; brew upgrade; _cleanup'
#OR
(BREW_PINNED=($(brew list --pinned | sort | tr '\n' ' ')); function _cleanup() { brew cleanup && brew cask cleanup; brew pin "$BREW_PINNED[@]"; }; trap _cleanup INT; echo "Pinned: $BREW_PINNED"; brew unpin "$BREW_PINNED[@]"; brew upgrade; _cleanup)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment