简体   繁体   中英

How to change prefix of HomeBrew?

Hello everyone, i have change my Mac from Mac Silicon to my new Intel chip Mac. I have backup to my new intel Mac and Homebrew have this error

Warning: Your Homebrew's prefix is not /usr/local.

Many of Homebrew's bottles (binary packages) can only be used with the default prefix. Consider uninstalling Homebrew and reinstalling into the default prefix. It is expected behaviour that some formulae will fail to build in this unsupported configuration. It is expected behaviour that Homebrew will be buggy and slow. Do not create any issues about this on Homebrew's GitHub repositories. Do not create any issues even if you think this message is unrelated. Any opened issues will be immediately closed without response. Do not ask for help from MacHomebrew on Twitter. You may ask for help in Homebrew's discussions but are unlikely to receive a response. Try to figure out the problem yourself and submit a fix as a pull request. We will review it but may or may not accept it.

And when i install dart with command "brew install dart" it show this error: Error: Cannot install on Intel processor in ARM default prefix (/opt/homebrew)!

How can i change my prefix from /opt/homebrew to usr/local... Thank you very much

I have try to uninstall and reinstall, and it don't work

To fix the Homebrew's prefix issue, following steps worked for me with Linux x86_64. Before proceeding, brew doctor would return Your Homebrew's prefix is not {desired location}

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

  2. Delete any folders containing brew installation like home/linuxbrew/ directory.

  3. Use brew install script from here and update the HOMEBREW_PREFIX to the desired location. After editing, run /bin/bash install.sh . Detailed steps can be referred here

  4. Update .zshrc file to include export PATH=/{HOMEBREW_PREFIX}/bin:$PATH where HOMEBREW_PREFIX is the value of the path used in step 3.

  5. source.zshrc

After step 5, brew doctor should return Your system is ready to brew.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM