команды не найдены на zsh
Я использую z Shell ( zsh ) вместо bash по умолчанию, и происходит что-то не так, так что все команды, которые раньше работали, больше не распознаются:
РЕДАКТИРОВАТЬ:
так что же происходит? почему все команды потеряны?
Очевидно, что вам удалось испортить свою PATH переменную. (В вашем текущем месте PATH нет мест, где расположены общие коммунальные службы.)
Как вариант, для «сброса» zsh укажите полный путь к оболочке:
В вашем конфигурационном файле
найдите, где говорится: export PATH=a-bunch-of-paths-separated-by-colons:
вставьте это в конец строки, перед конечной цитатой: :$HOME/.local/bin
И это должно сработать для вас.
Сначала вы можете проверить, будет ли это работать, набрав это в своем терминале: export PATH=$HOME/.local/bin:$PATH
Если ошибка исчезнет после того, как вы введете это в терминал, и ваш терминал будет нормально работать, вышеуказанное решение будет работать. Если это не так, вам нужно будет найти папку, в которой находится ваша справочная ошибка (вещь не найдена), и заменить PATH выше на PATH-TO-THAT-FOLDER.
Вы можете создать символическую ссылку в / usr / local / bin /
Для меня просто перезапуск моего терминала решил проблему.
Я исправил проблему, открыв общую вкладку настроек терминала и изменив команду (полный путь) /bin/bash на значение по умолчанию, а затем отредактировав
. без пробелов между PATH=» и сохранить файл.
После сохранения файла измените /bin/zsh в своей команде или выберите по умолчанию
. и перезапустите терминал, и ваша оболочка zsh снова заработает!
Как только у вас есть это, перейдите в свой iTerm 2 и вставьте свой путь в опцию «отправить текст при запуске».
Просто снова откройте iTerm 2, и все готово!
commands not found on zsh
I am using the z Shell ( zsh ) instead of the default bash, and something wrong happen so that all commands that used to work are no longer recognized:
EDIT:
I even tried to reset zsh as indicated in this thread, but always got command not found error:
So what’s going on? Why all commands are lost?
21 Answers 21
It’s evident that you’ve managed to mess up your PATH variable. (Your current PATH doesn’t contain any location where common utilities are located.)
Alternatively, for «resetting» zsh, specify the complete path to the shell:
/.zshrc file, after save file run source
/.zsh config file include the path to your bash path file that contains your aliases. In my case it was including the line «source
/.bash_profile» inside of
find where it states: export PATH=a-bunch-of-paths-separated-by-colons:
insert this at the end of the line, before the end-quote: :$HOME/.local/bin
And it should work for you.
You can test if this will work first by typing this in your terminal first: export PATH=$HOME/.local/bin:$PATH
If the error disappears after you type this into the terminal and your terminal functions normally, the above solution will work. If it doesn’t, you’ll have to find the folder where your reference error is located (the thing not found), and replace the PATH above with the PATH-TO-THAT-FOLDER.
I fixed the issue by opening the terminal preference general tab and changing the Command (complete path) to /bin/bash to default and then editing the
. without any whitespace between the PATH=» and save the file.
After saving the file, change the /bin/zsh in your command or select default
. and restart terminal and you should have your zsh shell working again!
You can create a symlink in /usr/local/bin/
Change back to bash :
Best solution work for me for permanent change path
Open Finder-> go to folder /Users/ /usr/local/bin
.zshrc is hidden file so unhide it by command+shift+. press
delete file content and type
export PATH=
and save
zsh: command not found Gone
On MacOS BigSur Click Terminal >> Preferences change the from /bin/zsh to /bin/bash Close and reopen the terminal
FROM
For me just restarting my terminal seemed to fix the issue.
If you like me, you will have two terminals app, one is the default terminal with bash as the default shell and another iTerm 2 with zsh as its shell. To have both commands and zsh in iTerm 2 from bash, you need to do the following:
At this point you will have the zsh as your default shell ONLY for iTerm 2 and you will have bash as the global default shell on default mac terminal app. Next, we are still missing the commands from bash in zsh. So to do this, you need to go on your bash (where you have your commands working) and get the PATH variable from env (use this command to do that: env | grep PATH ).
Once you have that, go to your iTerm 2 and paste your path on «send text at start» option.
After installing Homebrew I get `zsh: command not found: brew`
19 Answers 19
for this error zsh: command not found: brew
Homebrew has been installed on you computer. You need to modify your PATH like this:
or execute brew from its origin:
Here are the steps I did.
2.Run brew help and see if it’s working. If it showing an error «zsh: command not found: brew» follow along.
Remember to change the «USER NAME» with yours, Then type in:
Once successfully running these command type «brew help» to see if everything went ok.
I got the same issue after installing Homebrew in my MacBook (macOS Big Sur V 11.0.1).
After installation, in the console it says what should be done,
Executing above two commands in order, will add the brew command into the PATH.
Just add export PATH=/opt/homebrew/bin:$PATH in your home directory
Restart if needed or just reopen your terminal
make sure install brew first
set: Universal variable ‘fish_user_paths’ is shadowed by the global variable of the same name.
This morning i too faced the same issue. The problem is path for homebrew is not set correctly.
Follow below steps
1.install homebrew correctly. In the terminal type below cmd.
In terminal type source
Basically your homebrew is saved in /opt/homebrew/, and not in /usr/local/. path
and restart the terminal. You will have it up and running.
I will just demonstrate the answer from @Spindizzy terminally speaking:
Paste PATH=/opt/homebrew/bin:$PATH there, save file and restart terminal.
If you’re on WSL2 make sure to follow the final linux installation instructions for linuxbrew.
Go to the official Homebrew site.
Try: brew install hello
The path to my brew installation bin directory is /home/linuxbrew/.linuxbrew/bin
Add following line to the
/.zshrc file
export PATH=/home/linuxbrew/.linuxbrew/bin:$PATH
After this do open a new terminal and the brew command will not be available.
Getting «zsh: command not found: brew» error when installing youtube.dl #10187
Comments
summitisadoofus commented Dec 31, 2020
Im new to macos, so apologies if Im a noob.
I installed Homebrew on M1 mac running Big Sur 11.1, and I installed XCode, but when I try to install youtube-dl I get this error message and I dont know what to do. Seems like my Macbook Pro doesnt see that I have Homebrew installed or something.
The text was updated successfully, but these errors were encountered:
carlocab commented Dec 31, 2020
Also, please don’t ignore the issue template. It’s there for a reason.
summitisadoofus commented Dec 31, 2020 •
Im a total noob like I said, I have used macos for a 2 weeks now. I have no idea what that export command means.
I ran that command successfully and tried brew install youtube-dl and got the same error.
summitisadoofus commented Dec 31, 2020
Even when I do brew search I get the same error.
Rylan12 commented Dec 31, 2020
Do you know if you installed Homebrew using Rosetta 2? If so, the correct command might be:
summitisadoofus commented Dec 31, 2020
I ran those commands.
carlocab commented Dec 31, 2020 •
When sharing the output of commands, please avoid using screenshots. Instead, copy and paste the command along with its output. Use a gist if you have to. You can format the text from your terminal using markdown.
What do these commands return?
summitisadoofus commented Dec 31, 2020
Last login: Thu Dec 31 19:25:57 on ttys000
tonikumpula@Tonis-MBP
% export PATH=»/opt/homebrew/bin:$PATH»
tonikumpula@Tonis-MBP
carlocab commented Dec 31, 2020
You missed one command.
summitisadoofus commented Dec 31, 2020
Last login: Thu Dec 31 19:43:32 on ttys000
tonikumpula@Tonis-MBP
% export PATH=»/opt/homebrew/bin:$PATH»
tonikumpula@Tonis-MBP
carlocab commented Dec 31, 2020
Can you paste the output of
summitisadoofus commented Dec 31, 2020
Last login: Thu Dec 31 20:03:56 on ttys000
tonikumpula@Tonis-MBP
% export PATH=»/opt/homebrew/bin:$PATH»
tonikumpula@Tonis-MBP
% brew config
HOMEBREW_VERSION: 2.7.1
ORIGIN: https://github.com/Homebrew/brew
HEAD: fdb71a5
Last commit: 3 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 2c069f8
Core tap last commit: 14 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 12.0 build 1200
Git: 2.24.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.1-arm64
CLT: 12.3.0.0.1.1607026830
Xcode: N/A
Rosetta 2: false
tonikumpula@Tonis-MBP
% brew doctor
Your system is ready to brew.
tonikumpula@Tonis-MBP
carlocab commented Dec 31, 2020
Rylan12 commented Dec 31, 2020
It looks like you just need to add the export line to the bottom of
The easiest way to do this is to run the following command:
summitisadoofus commented Dec 31, 2020 •
Argh, I cant get this working no matter what I try.
I managed to install youtube-dl but I have to run export command everytime I wanna use homebrew. And when I try to use youtube-dl I get error zsh: no matches found
I also ran echo ‘export PATH=»/opt/homebrew/bin:$PATH»‘ >>
/.zshrc with no help.
carlocab commented Dec 31, 2020
What do these commands say?
summitisadoofus commented Dec 31, 2020
Last login: Fri Jan 1 00:44:11 on ttys000
tonikumpula@Tonis-MBP
Rylan12 commented Dec 31, 2020 •
That’s odd. Can you paste the output of the following commands when run in a new terminal?
carlocab commented Dec 31, 2020
You can delete one of those duplicate lines. Add something like
I recently installed zsh and oh-my-zsh in my Mac. Now when I try to run a maven command from the terminal, I am getting the following error.
As seen above, I appended location of maven installation to the path. But I am still getting errors. Any help is appreciated.
17 Answers 17
Question:
zsh: command not found: mvn
Answer:
step 2:(Add at the end of the file)
step 3:(Execution shell)
You can use mvn :
I had a similar problem after installing oh-my-zsh, but for adb command. Looks like the PATH is shortened when oh-my-zsh is installed. I solved it using following steps.
Look for # User configuration
Un-comment the following line:
Give this one a try for other similar command not found errors.
Open terminal and run command vi
Add below lines in file:
Save file successfully
/.zshrc to take the settings into effect instantly.
Once added, as others suggested, source the
after this gandharvmehra@MacBook-Pro
close the Terminal and open again
it should work 100 percent
I faced the exact same issue, this is what worked for me:
Use i to insert the export statements. Once inserted, use esc to exit insert mode. Then use :wq! to save and quit the editor. Finally, source the file to see the effects of your new changes.
Now try mvn and you should see something like this.
I have similar issue today with mvn command not found






























