Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)

80,734

Solution 1

For what it's worth, before installing Homebrew you will need to install Rosetta2 emulator for the new ARM silicon (M1 chip). I just installed Rosetta2 via terminal using:

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

This will install rosetta2 with no extra button clicks.

After installing Rosetta2 above you can then use the Homebrew cmd and install Homebrew for ARM M1 chip: arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Once Homebrew for M1 ARM is installed use this Homebrew command to install packages: arch -x86_64 brew install <package>

Solution 2

Homebrew needs to be installed in two places on Apple silicon: in /usr/local for rosetta-emulated (Intel) code, and /opt/homebrew for ARM64. These are somewhat hard-coded and the /opt/homebrew one MUST be used for ARM code, as it stands today, and is non-negotiable. However, it's easy enough to install and you can follow the general instructions on the official docs. You open a Rosetta shell first.

% arch -x86_64 zsh
% cd /usr/local && mkdir homebrew
% curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

Later, to install tools under intel you can use the arch command per-command or open a zsh terminal as above.

arch -x86_64 /usr/local/homebrew/bin/brew install sometool

For the ARM architecture, you don't need to use arch but you do need to use the full path of the homebrew command.

/opt/homebrew/bin/brew install sometool

You could rename the brew commands to something like brew86 and brewARM to help keep them separate.

Solution 3

Just use:

arch -arm64 brew install package-name

replace 'package-name' with the package you want to install.

Solution 4

Did a temporary fix by enabling Open using Rosetta option in the terminal app from Utilities folder.

However, it would be great to know the actual solution for this question to use the native way.

enter image description here

Solution 5

This issue with new macbook pro M1 chip

Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!

For Resolve follow below steps

Step1

$ brew bundle dump

Step2

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

Step3 Edit file below

$ vi ~/.bashrc or vi ~/.zshrc

Edit below line in above file

export PATH=/opt/homebrew/bin:$PATH

Share:
80,734
Prashanth Sams
Author by

Prashanth Sams

Author of Selenium Essentials O'Reilly | PacktPub | Amazon.in | Amazon.com | Amazon (Kindle) | Google | Barnes&Noble | Apple Store Selenium WebDriver, Appium, API, Locust, Cucumber, Docker, Helm, Kubernetes, Jenkins, Jenkins job-dsl, AWS, Git, Github, Gitlab, Ruby, Python, JavaScript, TypeScript, Groovy, Shell, Protractor, Java, Grafana, Prometheus, Datadog, Graphite, CasperJS, Behave, JBehave Blog: http://www.seleniumworks.com/ https://devopsqa.wordpress.com/ Skype: prashanth.sams Official Site: http://prashanthsams.com Twitter: https://twitter.com/prashanthsams GitHub: https://github.com/prashanth-sams LinkedIn: https://www.linkedin.com/in/prashanth-sams-58208953/ Google+: https://plus.google.com/u/0/104394276212961437513/posts Facebook: https://www.facebook.com/groups/selenimusers/

Updated on February 10, 2022

Comments

  • Prashanth Sams
    Prashanth Sams over 2 years

    I use the latest Apple M1 chip processor. And I keep getting errors while application installation.

    say.,

    brew install openjdk@11
    
    Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
    Please create a new installation in /opt/homebrew using one of the
    "Alternative Installs" from:
      https://docs.brew.sh/Installation
    You can migrate your previously installed formula list with:
      brew bundle dump
    

    Need help with exact steps to follow.

  • indojin over 3 years
    "You could rename the brew commands to something like brew86 and brewARM to help keep them separate" - How exactly to do this?
  • SamJakob
    SamJakob over 3 years
    @indojin You can use a ZSH alias. By adding alias brew86="arch -x86_64 /usr/local/homebrew/bin/brew" and alias brewARM="/opt/homebrew/bin/brew" to your ~/.zshrc file
  • Martin
    Martin over 3 years
    I also used the alias. I wonder why this is not standard for the homebrew installation... ;)
  • Martin
    Martin over 3 years
    Problem with this is that in the end you will eventually need to use both homebrew versions. The answer should at least point out the consequences of this change... ;)
  • Maniprakash Chinnasamy about 3 years
    I have already installed HomeBrew in this path /opt/homebrew/ and installed Nginx and PHP too which is working properly. Does this break if I execute the above command?
  • Ty Conway
    Ty Conway about 3 years
    How do you know if want to install something to 86 or ARM?
  • Omar Shabab
    Omar Shabab about 3 years
    After this command : /usr/sbin/softwareupdate --install-rosetta --agree-to-license I get Installing Rosetta 2 on this system is not supported.
  • manoj patel about 3 years
    my answer based on M1 chips and my experience
  • PARITOSH THAPLIYAL
    PARITOSH THAPLIYAL about 3 years
    Thanks. The approved answer did not work for me for some reason. But after I ran the commands including CURL. I have been able to install the package.
  • Vikas Sharma
    Vikas Sharma about 3 years
    I am also facing the same issue is there any other workaround for this Installing Rosetta 2 on this system is not supported.
  • dwaz almost 3 years
    This works and doesn't require brew to be installed twice.
  • Duc Nguyen
    Duc Nguyen almost 3 years
    Uncheck run with rosetta in terminal and it can be install Rosetta 2. It works for me
  • Hung Vu
    Hung Vu almost 3 years
    i unchecked rosetta in terminal, but it still get that error @DucNguyen
  • user3305074
    user3305074 almost 3 years
    Quit terminal and then try again.
  • benomatis over 2 years
    I'm wondering what the difference is between this solution and the one @court3nay provided - there 2 instances of brew is installed, one using rosetta, another one for ARM - this one here only uses rosetta, so will I be missing out on anything if I use this option only?
  • rahul
    rahul over 2 years
    Add an alias alias brew86="arch -x86_64 /usr/local/homebrew/bin/brew" to your .zshrc for future convenience
  • jmealy over 2 years
    Seconding @Martin's note above. Regardless of your experiences, it'd be good to make folks aware.
  • rsaha77
    rsaha77 over 2 years
    For those getting the response: "Permission denied @ rb_file_s_symlink", try: $ sudo chown -R $(whoami) $(brew --prefix)/*
  • RandomDeveloper
    RandomDeveloper over 2 years
    hey, thanks for this btw. After adding your 3rd command to install my package, which in this case is rgdbs - rgbds.gbdev.io/install/macos - getting the following error: /usr/local/Cellar/libpng/1.6.37 is not a valid keg Any ideas?
  • Gnardog
    Gnardog about 2 years
    I had the error Installing Rosetta 2 on this system is not supported., and solved it by doing the following: 1. I had previously set up my terminal to 'run with Rosetta', so I decided to duplicate it and rename the new application 'Rosetta-Terminal' (optional, but good if you need rosetta for other things) 2. Unchecked 'run with rosetta' in 'get info' of 'Terminal'. 3. Quit and Reopen Terminal... ran the command and it worked
  • sday about 2 years
    This was the simple answer for my 2021 M1 Max running on Monterey 12.1. If new to nginx, read the output of the install. You do need to start the service and by default it's listening on port 8080 on version 1.21.6_1 of nginx.
  • Abana Clara
    Abana Clara about 2 years
    After running this I was able to run brew install php with no problems
  • Dashiell Rose Bark-Huss
    Dashiell Rose Bark-Huss about 2 years
    didn't work for me to upgrade node
  • Dashiell Rose Bark-Huss
    Dashiell Rose Bark-Huss about 2 years
    This works but it's missing some steps. After you run the first command make sure you run the two commands brew asks you to run. And after running brew bundle dump move the BrewFile created by brew bundle dump into opt/homebrew. From that directory, run brew bundle install. brew bundle dump doesn't install the packages, it just creates a BrewFile that tells brew what packages it should install when you run brew bundle install. Like a package.json file in node.js.
  • Ram Fattah
    Ram Fattah about 2 years
    @Gnardog thank you so much, this indeed worked from my end as well!
  • Pin
    Pin almost 2 years
    An additional note to Dashiell's comment: make sure you run brew bundle dump with /usr/local/Homebrew/bin/brew or otherwise you'll be executing the newly installed brew, which won't have access to the old packages.