Home > Blockchain >  no packages are recognised by zsh
no packages are recognised by zsh

Time:11-13

I have previously installed npm, homebrew, oh-my-zsh and other runtime environments and worked perfectly on my Mac M1, until recently, no packages or runtime environments are being recognised.

When I enter brew I get error as zsh: command not found: brew but I can see in my opt/ path that there's homebrew folder and its content present,

Similarly for npm it shows error zsh: command not found: npm

I might have done something with my PATH

Here's a screenshotMac Terminal

Edit: My .bash_profile is empty, should it be empty?? .bash_profile

CodePudding user response:

On the M1 Macs, homebrew files are installed by default in /opt/homebrew, and the executables are usually placed in or linked to /opt/homebrew/bin. That directory is not in your search PATH - instead, it looks like you have the PATH settings for an Intel Mac.

As you noted, updating the PATH should fix the issue, but first you need to determine which shell you are using (the question is tagged both zsh and bash). It's probably zsh, since that's the default on newer versions of macOS, and it would explain why the .bash_profile is empty. You can double-check this with the command echo $0.

There are several ways to update the path, and many are described in other posts here at SO, such as this one. This will also work for zsh:

print 'PATH=$PATH:/opt/homebrew/bin' >> ~/.zshrc
  • Related