pritom
pritom

Reputation: 53

Install azure cli via brew not working in mac m1

I have be trying to install azure cli in new mac m1. But it fails. I get the following error

brew reinstall azure-cli
==> Downloading https://ghcr.io/v2/homebrew/core/azure-cli/manifests/2.22.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/azure-cli/blobs/sha256:1980c967
==> Downloading from https://pkg-containers-az.githubusercontent.com/ghcr1/blobs
######################################################################## 100.0%
==> Reinstalling azure-cli 
==> Pouring azure-cli--2.22.1.arm64_big_sur.bottle.tar.gz
🍺  /opt/homebrew/Cellar/azure-cli/2.22.1: 19,449 files, 329.3MB

After Pouring it just stops. I also tried to install using pip3 and I can install that successfully but when I type "az" command I get the following error

/opt/homebrew/bin/az: line 2: 64784 Killed: 9               AZ_INSTALLER=HOMEBREW /opt/homebrew/Cellar/azure-cli/2.22.1/libexec/bin/python -m azure.cli "$@"

Upvotes: 5

Views: 5678

Answers (2)

md12
md12

Reputation: 31

I had some trouble with this too, I took the following steps to install and access the azure cli (I did this on an M1 Mac, OS 13.2.1):

  • Uninstalled brew with /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
  • Ran brew doctor
  • Deleted files that brew doctor was complaining about (copied the path and opened up a finder window and typed CMD shift G and pasted the path here then pressed enter)
  • Ran brew doctor again and it didn't complain
  • Ran /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" to install homebrew
  • Ran (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/somefolder/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)" to add homebrew to my PATH
  • Installed rosetta
  • Next, If I typed where python3 to see a list of other Python3 installs on my machine and their interpreter paths, anything installed by Homebrew should include the word homebrew in the path e.g. /opt/homebrew/bin/python3
  • Installed a version of python with homebrew if it didn't already exist brew install [email protected]. I would delete an exisiting version with brew install [email protected] if it already exisited.
  • If you're executing commands in a terminal within VSC ensure you've added the interpreter path e.g. /opt/homebrew/bin/python3 and select it for the terminal session.
  • Ran brew update && brew install azure-cli
  • Ran az --help to ensure the install worked

Upvotes: 0

Frank Borzage
Frank Borzage

Reputation: 6796

As mentioned in the comments: My python3 wasn't installed via brew. So first uninstalled brew and python3. Then installed brew again(before that made sure Rosetta 2 is working). Then tried brew doctor. There was error saying /usr/... then, I deleted those files. Once successfully removed/deleted brew doctor will run fine.

Upvotes: 3

Related Questions