How To Fix “brew command not found” on Mac with zsh | How to fix Zsh: Command not found: Brew?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so once you have installed home bre and when you give this command which is Brew space help for example and then press enter it's going to complain that Brew is not uh found by this zsh terminal so if you are using the newer version of Mac OS the default terminal on Macos is zsh and zsh is not able to recognize the Brew command because the Brew binary path is not set in our zshrc so now what you need to do is in your home folder so make sure you are in your home folder and if you're not sure just write CD and then press enter and this will bring you to the home folder on your terminal here give Lis space uh hyphen Al command which is going to show you uh all the hidden files and also other folders on your home directory here I don't see zshrc file so I need to create a new shrc in my Mac operating system if you see do zshrc in this list then you just need to open that and then just add the line which I'm going to show you right so first of all we need to know where Brew installs itself right so generally Brew installs itself in a directory called for/ opt it creates the directory called home brew in opt uh folders so opt for slome brew and then the home brew binary will be in this directory so when I do LS I can see this Brew binary and this is not recognized yet by zsh right so to uh add this let me clear the terminal and then I can give this command which is nano and then dot zshrc so we need to create this do zshrc file and then add the export for the binary directory for the Brew so I'm going to just uh press enter which is going to create this zshrc and then here just type export space path is equal to and in the double codes you need to provide that path which is opt for slash home brew for slash bin and then you just need to give this colon symbol and then give Dollar in capital path and then close your double quotes now I'm going to give you this line in the description of this video so you can directly copy this command and paste it in your uh zshrc file once you are done press crol X on your keyboard so press contr X and once you see this this kind of output which says save modified buffer press y key on your terminal which is going to save your changes into the file which you have created and then press enter which is going to exit out of the Nano tool right now once you are done you can again give LS space hyphen Al command to verify if everything is working so it should be LS and not l a let me give this command and you can see this do zshrc file is created and then when I do uh cat do zshrc it's going to show you the content of that zsh uh RC file which is this line which we have added once that's done the last command we need is the source command so just write source and then dot SRC what this command does is it loads the binary uh path which you have ex uh exported in the current terminal itself right so you don't need to close the terminal and restart the terminal once again press enter which is going to Source this zshrc file once you done let me clear the terminal and then let's try the Brew help command once again so I'm going to just write bre and then help command and then press enter and now this time Brew is working on my uh Mac operating system right so as I said Brew is a package manager so you can install some packages using Brew right so so for example you want to install a package called Git You can give this command which is Brew install and then the package name so if you want to search for the packages you can always go to brew uhsh uh website and here you can search for the packages so you can see when I give git uh command you can see this is how you can install git and you will be able to see the versions of git here you can also find all this in your terminal itself self right so let me show you how you can just find that package you can just give this command in your terminal to find the package so I'm going to give this uh Brew Search Command and then when I write get here it's going to search for the git package so you can see there are so many uh packages related to git right and the package we wanted to install is this git one but there are some other packages from many de developers here so you can install these packages and you can use git in few different ways right I hope youve enjoyed this video and I will see you in the next
Info
Channel: ProgrammingKnowledge2
Views: 7,281
Rating: undefined out of 5
Keywords:
Id: f2BXWXOsrEA
Channel Id: undefined
Length: 6min 42sec (402 seconds)
Published: Sat Nov 18 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.