installaware/AGPT

Homebrew gets installed into the wrong prefix.

pelted opened this issue · 7 comments

pelted commented

Looks like when the option to "install Homebrew" is checked (accidentally in my case) the installer causes the the install to /usr/local instead of the recommended /opt/homebrew for Apple Silicon. This has the effect of breaking an existing homebrew install or setting up the wrong location for new installs.

Actually the AGPT instructions (as seen in the Apple Developer download DMG's readme file) clearly indicate that Homebrew must be installed in /usr/local. This is because the x86_64 version must be installed (and invoked for the remainder steps) as opposed to the native Apple Silicon version (which indeed does go into /opt/homebrew). The same AGPT instructions recommend removing Homebrew for Apple Silicon first in this scenario, if it is already present. I believe what you have come across should be classified as a bug in the current installer which does not check for this. Ultimately the issue seems to stem from the fact that Wine is currently Rosetta (x86_64 on Apple Silicon) only, and cannot be properly installed with the Apple Silicon version of Homebrew for that same reason.

And how do you remove homebrew?

I personally don't think removing homebrew is the right answer; the homebrew computer club is where Apple was founded in the first place, and it's by far the most used package manager for installing native applications and tools

If which brew shows the /usr/local/bin/brew path, you can temporarily switch for the session of your terminal with eval "$(/opt/homebrew/bin/brew shellenv)" or vice-versa

The latest release has been updated to uninstall Homebrew for Apple Silicon where necessary after user confirmation.

There's no way to keep the ARM64 version and that AGPT still installs x64 homebrew?

Like mentioned in https://www.applegamingwiki.com/wiki/Game_Porting_Toolkit:

Optionally retain both ARM64 and x86 versions of Brew
If you want to have both ARM64 and x86 versions of Brew installed, begin by editing your .zshrc file: nano ~/.zshrc
Scroll down (by using the arrow keys or Control + V) to the bottom of the file, and paste the following script:

if [ "$(arch)" = "arm64" ]; then
    eval "$(/opt/homebrew/bin/brew shellenv)"
else
    eval "$(/usr/local/bin/brew shellenv)"
fi

You may now restart your terminal and use the following command to return to an x86_64 shell: arch -x86_64 zsh Your shell will now select the right installation of Brew, depending on your architecture.
(For bash holdovers: zsh instructions above also apply to bash. Just replace .zshrc with .bashrc and .zprofile with .bash_profile.)

This is actually a great suggestion.

Why not download the sources and start tweaking?

We've just pushed out a new update for the installer which you could fork.