Search code examples
node.jsmacoshomebrewmacos-catalinanvm

Why can't I start using a recently installed package with Hombrew in macOS Catalina?


I've recently installed macOS Catalina and tried installing Homebrew + NVM but it seems I didn't do it correctly.

It seems that I installed NVM just fine

wayoshi@Uwu-MacBook-Pro ~ % brew list
nvm

But I cannot use the package:

wayoshi@Uwu-MacBook-Pro ~ % nvm install 12.21.0
zsh: command not found: nvm

I have this in my ~/.zshrc

export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH=$HOME/bin:/usr/local/sbin:$PATH

And this is what I get when I run printf '%s\n' $path

/Users/wayoshi/bin
/usr/local/sbin
/Users/wayoshi/bin
/usr/local/bin
/Users/wayoshi/bin
/usr/local/sbin
/Users/wayoshi/bin
/usr/local/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

I guess this has something to do with env variables. Would you have any idea why this happened?


Solution

  • Say brew info nvm for instructions on how to configure your shell to see nvm. It sounds like you didn't follow those instructions:

    You should create NVM's working directory if it doesn't exist:
    
      mkdir ~/.nvm
    
    Add the following to /Users/<you>/.bash_profile or your desired shell
    configuration file:
    
      export NVM_DIR="$HOME/.nvm"
      [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
      [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm"  # This loads nvm bash_completion