Logo

dev-resources.site

for different kinds of informations.

zsh: command not found: brew

Published at
3/10/2024
Categories
git
setup
beginners
vscode
Author
naalaryea
Categories
4 categories in total
git
open
setup
open
beginners
open
vscode
open
Author
9 person written this
naalaryea
open
zsh: command not found: brew

My first time setting up git on my Macbook was a few years ago. My second time was this week, and I faced the same error I faced the first time, except I didn't take note of how I fixed it. So I am writing this short article, hoping that the next time I face this issue again, I know where to find a possible solution.

So basically, I'm writing this for me. However, if anyone else faces this error and this helps them too, then that is a bonus.


Setting up git on a new laptop

1. Go to the git download page here.

Download the appropriate version according to your device.

Since I am using a Macbook, I download the version for Mac.

To download, first install homebrew by running in your
terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Enter fullscreen mode Exit fullscreen mode

2. According to the documentation, after installing homebrew, in your terminal, run:

brew install git
Enter fullscreen mode Exit fullscreen mode

Except, once I run this, it throws an error:
zsh: command not found: brew

However, running git --version confirmed I had git installed:

git --version
Enter fullscreen mode Exit fullscreen mode

git version 2.39.3 (Apple Git-146)

It became clear that homebrew was not added to the PATH variable during installation, therefore shell could not locate the homebrew executable.

To rectify this, add homebrew to the PATH variable by doing the following:

  • In your terminal, run:
export PATH="/opt/homebrew/bin:$PATH"
Enter fullscreen mode Exit fullscreen mode

Hit the Enter key.

  • Run:
echo $PATH
Enter fullscreen mode Exit fullscreen mode

in your terminal to confirm if homebrew was successfully added to the PATH variable.

This returns a list of all the executables found on your laptop. Confirm that homebrew is present in the list. If it is, your terminal will now be able to locate homebrew.

3. Now, in your terminal, run brew install git again and hit Enter

brew install git
Enter fullscreen mode Exit fullscreen mode

Wait patiently for the download to complete.

You have successfully installed git on your laptop. You can now continue on to set up git in VS Code. Check out this documentation on how to do that.

setup Article's
30 articles in total
Favicon
.NET DEVELOPER TOOLS NEED TO INSTALL FOR NEWLY PC
Favicon
Exploring Localhost 127.0.0.1:49342: Setup and Usage Guide
Favicon
Mastering Jenkins: A Step-by-Step Guide to Setting Up and Supercharging Your CI/CD Workflow
Favicon
Personal TODO list on how I set up my dev machine
Favicon
CĂłmo usar varias SSH keys para diferentes repositorios de GitHub (o GitLab)
Favicon
Tech and Tools I use
Favicon
How to Set Up a New TypeScript Project
Favicon
How to install SDL2 on macOS
Favicon
Multiple Node.js versions - setup memo
Favicon
Elevate Your Gaming Setup: Affordable Alternatives for Setup Gaming
Favicon
How to set up HTMX in Django
Favicon
Créez Votre Configuration p Jeu Parfaite : Découvrez nos Offres dès Aujourd'hui !
Favicon
Kitty + Neovim: Aesthetic Dev Setup
Favicon
Um pouco de mim
Favicon
Pop_OS Japanese layout
Favicon
The fastest setup of enhanced conversions for Google Ads.
Favicon
zsh: command not found: brew
Favicon
Dill Processing Plant Plant Project Report 2024, Setup Details, Machinery Requirements and Cost Analysis
Favicon
Hair Oil Manufacturing Plant Project Report 2024, Cost, Industry Trends and Business Opportunities
Favicon
Glutamic Acid Manufacturing Plant Project Report 2024, Machinery, Cost and Raw Material Requirements
Favicon
How to set up Python for backend development
Favicon
Setting Up Your macOS Development Environment and Automating Backups.
Favicon
What is use for work as a developer - Basic Flutter setup
Favicon
Trabalhando com 2 pc's no setup,Dicas!🖥️
Favicon
The JavaScript Developer's Guide to Ubuntu on Windows 11 with WSL
Favicon
My Kubernetes Lab Setup - Using Vagrant & Docker
Favicon
Setup MacMini M1 for Development
Favicon
Setup MacMini M1 for Development
Favicon
How to install and setup Neovim with awesome plugins
Favicon
Redis Local setup

Featured ones: