Last active
September 10, 2025 18:53
-
-
Save joelkesler/d1993f1031e130fd67603c640646f274 to your computer and use it in GitHub Desktop.
Update NVM to Latest Version (for Bash and Zsh)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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"; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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