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
команды не найдены на 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.
zsh: command not found: brew #3507
Comments
AlmogRnD commented Jan 20, 2015
export PATH=»/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin»
export PATH=»/bin /usr/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/local/git/bin»
The text was updated successfully, but these errors were encountered:
apjanke commented Feb 18, 2015
Can you post your entire
/.zshrc file as a gist, and your output for the following sequence of commands?
AlmogRnD commented Feb 18, 2015
Got it working had to uninstall and reinstall everything
robbyrussell commented Feb 18, 2015
Zorigt commented Oct 18, 2018 •
Uninstalling and re-installing homebrew didn’t work, but I did the following which worked for me.
/.zshrc file in text editor like vim or similar. Then, uncomment the export line for the below section. Source your file like so source
Hellowor1d commented Sep 9, 2019 •
If you use zsh in Debian
amairi commented Oct 27, 2020 •
tyirvine commented Jul 13, 2021
Don’t forget to close and open a new zsh/bash session after installing HomeBrew. I forgot to do this wondering why it wasn’t working lol
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
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.
16 Answers 16
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.
/.zshrc to take the settings into effect instantly.
Once added, as others suggested, source the
Open terminal and run command vi
Add below lines in file:
Save file successfully
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



























