Skip to content

Instantly share code, notes, and snippets.

@joelkesler
Last active September 10, 2025 18:53
Show Gist options
  • Select an option

  • Save joelkesler/d1993f1031e130fd67603c640646f274 to your computer and use it in GitHub Desktop.

Select an option

Save joelkesler/d1993f1031e130fd67603c640646f274 to your computer and use it in GitHub Desktop.
Update NVM to Latest Version (for Bash and Zsh)
#!/bin/bash
# I recomend adding this to your ~/.bash_profile
# Update NVM (Node Version Manager) to latest version
nvm-update(){
# This script will check and download the latest release of NVM
getLastestNVM() {
curl --silent "https://api.github.com/repos/nvm-sh/nvm/releases/latest" |
grep '"tag_name":' |
sed -E 's/.*"([^"]+)".*/\1/'
}
curl --silent -o- https://raw.githubusercontent.com/nvm-sh/nvm/$(getLastestNVM)/install.sh | bash
export NVM_DIR="$HOME/.nvm";
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh";
};
#!/bin/zsh
# I recomend adding this to your ~/.zprofile
# Update NVM (Node Version Manager) to latest version
nvm-update(){
# This script will check and download the latest release of NVM
getLastestNVM() {
curl --silent "https://api.github.com/repos/nvm-sh/nvm/releases/latest" |
grep '"tag_name":' |
sed -E 's/.*"([^"]+)".*/\1/'
}
curl --silent -o- https://raw.githubusercontent.com/nvm-sh/nvm/$(getLastestNVM)/install.sh | bash
export NVM_DIR="$HOME/.nvm";
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment