As a software and web developer, I know the pain of upgrading CLI tools like Node, Homebrew stuff, and others individually. To simplify this process, Iāve created a simple upgrade script, āUpgrade All The Thingsā. And gave it a handy shell alias.
The Script
The script itself is just a simple shell script that runs the following commands:
#!/bin/zsh
# Homebrewbrew update && brew upgrade && brew cleanup && brew doctor
# Source nvm. ~/.nvm/nvm.sh
# Nodenvm install 19 --reinstall-packages-from=node --latest-npm
# Global npm packagesncu -g
# corepackcorepack disableWhatās going on here?
The Homebrew stuff is pretty straightforward. For Node, I use nvm as the version manager, so I have to load it before using it. Then I install the latest version of Node (which I have pinned to a specific version) and reinstall all global packages.
I also use ncu to check for outdated global npm packages. Finally, I disable Corepack, because it messes up my pnpm installation from Homebrew (since Corepack does not always ship the latest version).
Shell Alias
To make it easier to run the script, Iāve created a shell alias for it. Iāve added the following line to my .zshrc file:
alias uatt="~/Scripts/upgrade-all-the-things.sh"