Jahanzaib Aslam
Jahanzaib Aslam

Reputation: 2834

mac - az command not found azure

I am trying to install Azure CLI 2.0 on my mac. I followed official documentation but facing this error.

bash: az: command not found

How can I fix this error on mac?

Upvotes: 16

Views: 28696

Answers (3)

Akash Verma
Akash Verma

Reputation: 847

rather than following this link https://learn.microsoft.com/en-us/cli/azure/get-started-with-azure-cli I suggest to install using home-brew on mac. Its simpler

brew update && brew install azure-cli

ref: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-macos

Upvotes: 22

granadaCoder
granadaCoder

Reputation: 27842

I hit the same issue.

Search around for how to create a ".bash_profile" file. This file usually (always?) exists at /Users/myusername/ folder

Then you will either create this file or edit this file.

Here is a "before" and "after" of my ".bash_profile".

export PATH=$PATH:/Applications/Terraform
export M2_HOME=/Users/shollid3/apache-maven-3.6.0
export PATH=$PATH:$M2_HOME/bin

and after

export PATH=$PATH:/Applications/Terraform
export PATH=$PATH:/usr/local/homebrew/bin
export M2_HOME=/Users/shollid3/apache-maven-3.6.0
export PATH=$PATH:$M2_HOME/bin

Obviously, the addition is

/usr/local/homebrew/bin

Use "where is" to (drum roll) find out where your "az" exists on your computer.

My "paper trail" was:

this below url

https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-macos?view=azure-cli-latest

led me to this below url:

https://docs.brew.sh/Installation.html

and eventually, that is how I got "az" installed to /usr/local/homebrew/bin

But regardless of where you have your "az", you can see how to add/edit bash_profile to get the path pointed to where you "az" is.

Upvotes: 2

Matt Park
Matt Park

Reputation: 25

Try the following command, or simply close and restart the Terminal session:

exec -l $SHELL

If that does not fix the issue, please share the output of your PATH variable by running

echo $PATH

Upvotes: 2

Related Questions