If brew install azure-cli fails on your Mac with a permission error, the cause is usually Homebrew directories that your user doesn’t own. I fixed it by unlinking Homebrew’s Python and taking ownership of /usr/local with chown, after which the install finished cleanly.
Below are the exact errors I hit, the commands that worked, and how to check that az is ready to use.
Why I needed az in the first place
I was working through some good hands-on tutorials on the Microsoft website, such as the “Cloud Skills Challenge: Microsoft Build: Build multimodal Generative AI experiences”. I enjoyed the learning. But the very first step, getting the az command to work on a Mac, is where a lot of people seem to get stuck. So I wrote down every fix I needed.
The quick fix
If you just want the commands, this is what worked for me:
# 1. Install Azure CLI with Homebrewbrew update && brew install azure-cli
# 2. If it fails with OpenSSL / Python permission errors:brew unlink python@3.11sudo chown -R "$USER":admin /usr/local/
# 3. Run the install againbrew install azure-cliThe rest of this post walks through each error in the order I hit them.
Step 1: Install Azure CLI with Homebrew
I followed Microsoft’s guide for installing Azure CLI on macOS, which uses Homebrew:
brew update && brew install azure-cliStep 2: OpenSSL permission error
The install failed with a permission issue on the openssl package.

I changed the owner of /usr/local/lib to my current user. That got past the OpenSSL error, but it wasn’t enough.
Step 3: Python permission error
Next I hit a Python permission issue in a different location under /usr/local.
Fixing one folder at a time wasn’t going to work, so I unlinked the existing Homebrew Python and applied the ownership change to the whole of /usr/local:
brew unlink python@3.11sudo chown -R "$USER":admin /usr/local/Step 4: Run the install again
With the permissions fixed, brew install azure-cli finished successfully.
Step 5: Check that az works
Confirm the CLI is on your path and see the installed version:
az --versionThen sign in to start using it:
az loginNotes before you run chown
| Situation | What to do |
|---|---|
Intel Mac (Homebrew in /usr/local) | The commands above apply as written. |
Apple Silicon Mac (Homebrew in /opt/homebrew) | The paths differ. Check which directories the error message names before changing ownership. |
You’d rather not change all of /usr/local | Homebrew’s error output usually lists the exact directories it can’t write to. Try chown on just those first. |
| Something still looks wrong | Run brew doctor to see what Homebrew reports. |
sudo chown -R on all of /usr/local is a broad change. It worked for me on a machine where I’m the only user, but on a shared Mac, start with the narrower option.
FAQ
How do I install Azure CLI on a Mac?
Run brew update && brew install azure-cli. If it fails with permission errors, follow Steps 2–4 above, then check the install with az --version.
Why does brew install azure-cli fail with a permission error?
In my case, my user didn’t own some Homebrew directories under /usr/local. Both the OpenSSL and Python steps failed for that reason.
Why did I need to unlink python@3.11?
Python hit its own permission error at a different location. Unlinking the existing Homebrew Python, together with the ownership fix, let the install complete.
Does this fix work on Apple Silicon Macs?
The idea is the same, but Homebrew lives in /opt/homebrew on Apple Silicon. Adjust the paths to match the directories your error message names.
How do I know the install worked?
Run az --version. If it prints version details, the CLI is installed. Then run az login to sign in.
Thanks for reading! You’re welcome to check out my other AI posts, or contact me via the links in the footer.