Search code examples
node.jsnvm

How to uninstall complete NVM in macOS


I have already installed Node.js v16 and Node Version Manager (NVM) on my mac. It's caused some conflict when try to run node.js application. I would like to uninstall NVM and remove all installed Node.js versions. How do i completely remove it?


Solution

  • You can remove $NVM_DIR which is usually ~/.nvm.

    rm -rf $NVM_DIR
    

    There will also be a snippet in your terminal profile file (i.e. .zshrc, .bashrc) which you can remove. The snippet safely loads NVM, so if it's not installed then nothing will happen.

    It'll look something like

    export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
    

    Afterwards you will need to restart your terminal to not have a lingering node alias.