Home > database >  Is there a reason the command 'mongo' works in VSCode terminal but not iTerm2 zsh terminal
Is there a reason the command 'mongo' works in VSCode terminal but not iTerm2 zsh terminal

Time:01-16

I just installed oh-my-zsh on iTerm2 and have been working on a project with MongoDB/node.

Now when I try to start the db with command 'mongo' I get a return 'zsh: command not found: mongo'

the command works perfectly fine in the built-in terminal for VSCode.

would like to be able to use iTerm exclusively instead of the vscode terminal.

CodePudding user response:

  1. Go to VSCode terminal and execute:

    echo "$PATH" 
    
  2. Check where the mongo binary is located:

    which mongo
    brew info mongo
    
  3. Go to your zsh and add to your .zshrc file the path where mongo is located:

    export PATH="$PATH:/opt/homebrew/bin" 
    
  4. If you do not add the path you will still be able to run it like:

    /opt/homebrew/bin/mongo 
    

CodePudding user response:

I'm not sure why, but when I went directly into the .zshrc file and added this line

export PATH="$PATH:/opt/homebrew/bin"

the command 'mongo' still didn't start the db.

BUT..

I figured it out. Instead of opening my .zshrc and editing it I just edited my path with this little line here with the path described by R2D2

path =/opt/homebrew/bin/

Command 'mongo' is working perfectly now!

  •  Tags:  
  • Related