6

I want a single command to update everything on my Mac command line. No more brew update && brew upgrade && brew cleanup && brew doctor and npm update -g and that complicated command to update everything in pip3. Is there an existing tool for this, or should I just use a script? Also, is this even a good idea? Is there any benefit to updating all my software individually?

For reference, this is the current function I have in my .zshrc that is supposed to update everything:

function update () {
  (brew update && brew upgrade && brew cleanup && brew doctor) &
  upgrade_oh_my_zsh &
  npm update -g &
  (pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip3 install -U) &
  (cd ~/.vim_runtime && git pull --rebase)
}
1
  • In general, the recommended practice is to (1) not update everything blindly but to determine if it'll break something first and (2) to prioritise security updates over other updates. The idea is that stability is preferred over latest features. And I'd recommend switching to MacPorts instead of Homebrew - MacPorts was created by Apple employee that also worked on the FreeBSD Ports system, and does things things the right (unix) way. It is faster, better, safer and has more packages than any other package manager for macOS.
    – sfxedit
    Sep 7, 2021 at 5:44

1 Answer 1

3

After asking this question many places, I've refined the function to be both more comprehensive and predictable (runs the updates in serial, instead of parallel).

This is the final result in my .zshrc (Updated Sept 2021):

function update () {
  softwareupdate --install --all
  (brew update && brew upgrade && brew cleanup && brew doctor)
  mas upgrade # https://github.com/mas-cli/mas
  npm update -g
  (pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip3 install -U)
  (gem update --system && gem update && gem cleanup) # https://github.com/rbenv/rbenv
  omz update # https://ohmyz.sh/
  (cd ~/.vim_runtime && git pull --rebase) # https://github.com/amix/vimrc
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .