Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple Silicon support in Homebrew #10152

Closed
fxcoudert opened this issue Dec 26, 2020 · 213 comments
Closed

Apple Silicon support in Homebrew #10152

fxcoudert opened this issue Dec 26, 2020 · 213 comments

Comments

@fxcoudert
Copy link
Member

fxcoudert commented Dec 26, 2020

Current status

We now have a majority of our formulas bottled for Apple Silicon: 70%. However, not all software is ready for ARM processors on macOS, and since we ship what upstream releases, there will be some formulas that take a long time to be fixed, have a new release… and some which will never support ARM.

Our level of support is this: Homebrew strives to ship ARM bottles for software that does support ARM. We can't fix every software that's out there, and we won't accept feature requests like “formula Z does not support ARM can you fix it”. The most useful way you can help that software work on ARM is to open a bug report with the software developers.

What formulas are supported? The ones that have an ARM bottle, i.e. an arm64_big_sur line in the bottle block. You can also check online at https://formulae.brew.sh


How you can help

  • If there is a formula that builds from source for you, and whose test is passing on Apple Silicon (brew install -s foo && brew test foo both work), please leave a comment below to let us know and we'll try building a bottle
  • If you know of a formula update that makes it work on Apple Silicon, please open a pull request for that update, using brew bump-formula-pr
  • If you care about specific software, trying building it from source, and if it fails, debug the issue and report it to its developers. This is the most useful thing you can do for the community ❤️

Also:

  • Do not report as “broken” formulas that are not bottled: instead, contact the software developers so they release a new version that works on Appel Silicon!

Current major blockers

We know these are not currently working, and are widely used. We are tracking their developers' progress and will be incorporating them as soon as possible:


PS: We had a previous gigantic issue tracking our work in previous months (before we roll out official support) at #7857 If you're trying to build something from source, be sure to go check there if someone has tried before you :)

@carlocab

This comment has been minimized.

@AddoSolutions
Copy link

AddoSolutions commented Dec 26, 2020

Just to confirm my understanding here, the Homebrew (the package manager) software itself is M1 ready, the installer script is pending Homebrew/install#373, and then there will be subsequent packages that require some hand-holding, however for the ~70% of packages out there that are ARM ready will be good to go with that MR?

There is a TON of info flying around and want just to verify understanding.

@Mushroom

This comment has been minimized.

@fxcoudert
Copy link
Member Author

@AddoSolutions yes, that sums it up nicely. We will communicate more clearly on this, in the next few days, through an official announcement.

@Mushroom if you could sort out Qt, you'd be a hero :)

@Mushroom

This comment has been minimized.

@fxcoudert

This comment has been minimized.

@Mushroom

This comment has been minimized.

@r58Playz

This comment has been minimized.

@carlocab

This comment has been minimized.

@sunilshah
Copy link

This may be off-topic but it is not clear how to install brew safely on an M1 machine to run both Rosetta 2 and arm64 versions of brew packages. I already have brew running under Rosetta2.

Running installation script natively, gives


 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Homebrew is not (yet) supported on ARM processors!
Rerun the Homebrew installer under Rosetta 2.
If you really know what you are doing and are prepared for a very broken
experience you can use another installation option for installing on ARM:
  https://docs.brew.sh/Installation

The instructions on alternate installation are unclear-it merely states what not to do, rather than what to do step by step.

@fxcoudert
Copy link
Member Author

@sunilshah The installer will be ready in a couple of days: Homebrew/install#373

@richiksc

This comment has been minimized.

@fxcoudert

This comment has been minimized.

@richiksc

This comment has been minimized.

@fxcoudert

This comment has been minimized.

@sunilshah
Copy link

@fxcoudert

Thanks for the response. Please let me know when I should try the native installer.

@richiksc
Copy link

@sunilshah, if you don't want to wait, you can also use the untar method of installation. This is what I have been using, and it has worked well - it essentially does what the installer script does, but manually.

mkdir opt
cd opt
mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

After Homebrew installs, make sure to add /opt/homebrew/bin to your PATH in ~/.zshrc. I tried .zshenv but since that gets called before the system PATH is loaded /usr/bin will be in front, and you won't be able to use the Homebrew versions of pre-installed executables like git.

@briandunn

This comment has been minimized.

@gpetrov

This comment has been minimized.

@fxcoudert

This comment has been minimized.

@fxcoudert
Copy link
Member Author

@briandunn we don't bottle HEAD builds, so let's keep this issue about stable versions

@gpetrov

This comment has been minimized.

@fxcoudert

This comment has been minimized.

@gpetrov

This comment has been minimized.

@vom513

This comment has been minimized.

@carlocab

This comment has been minimized.

@vom513

This comment has been minimized.

@carlocab

This comment has been minimized.

@carlocab
Copy link
Member

carlocab commented Jul 30, 2021

Are you sure the issue isn't in yadm as opposed to in brew? It looks to me as if it's looking for a Monterey bottle that won't be there, or is otherwise confused by your OS version. Or, to put it another way: it seems that you're only having problems when trying to interact with brew through yadm. Using brew directly seems to work fine.

@shaunsingh
Copy link
Contributor

Are you sure the issue isn't in yadm as opposed to in brew?

YADM bootstrap is just calling a shell script, which is in turn calling brew bundle --file="$HOME/Brewfile" The same thing occurs with running the command separately. It would be nice if someone could test this on Big Sur, just to rule out if its a Monterey issue or not

@carlocab
Copy link
Member

Probably an issue in brew bundle then. You'll want to report it here, I think: https://github.com/Homebrew/homebrew-bundle

@MikeMcQuaid
Copy link
Member

@shaunsingh should be fixed by Homebrew/homebrew-bundle#988

tetsuya added a commit to tetsuya/dotfiles that referenced this issue Aug 14, 2021
@emeraldsanto
Copy link

I've recently ran into issues with the brew cleanup command specifically on my M1 Mac mini, on both Big Sur and Monterey. Everything else seems to be working great but brew cleanup hangs every time (longest I've let it run was around 30 minutes) with no output. Has anyone else experienced this?

@MikeMcQuaid
Copy link
Member

@emeraldsanto Never heard of/seen that before. brew cleanup --debug --verbose may produce more output to help you figure out what's hanging.

@emeraldsanto
Copy link

@emeraldsanto Never heard of/seen that before. brew cleanup --debug --verbose may produce more output to help you figure out what's hanging.

You're right, upon running brew cleanup -d -v, the operation completed quickly, with logs saying which directories were cleaned and without errors! However, I immediately ran brew cleanup afterwards and got the same results as before: no feedback and a blinking cursor for a very long time 😅

Good news is I can now use that workaround when needed, thanks!

$ brew doctor
Your system is ready to brew.
$ brew -v
Homebrew 3.3.2-2-gb14078a
Homebrew/homebrew-core (git revision 63c932f6434; last commit 2021-10-31)
Homebrew/homebrew-cask (git revision 90dba73132; last commit 2021-11-01)

@mgrider
Copy link

mgrider commented Nov 7, 2021

I'm having a problem where Xcode build phase scripts do not pick up the home-brew path, despite the eval "$(/opt/homebrew/bin/brew shellenv)” command present in my .zshenv. Has anyone else run into this, or have a solution that isn't just "put the eval command in my build phase script"?

Update: I was able to work around the issue by adding a symlink to the executable I needed in /usr/local/bin.

@gromgit
Copy link
Member

gromgit commented Nov 8, 2021

@mgrider, you might want to read the Startup/Shutdown Files section of the zsh man page. ~/.zshenv is sourced before ~/.zprofile and/or ~/.zshrc, so it sounds like you're resetting your PATH in one of the latter.

@mgrider
Copy link

mgrider commented Nov 8, 2021

Thanks @gromgit, I appreciate the thought, but I don't think that's it. I have some prompt stuff in .zshrc, but none of the other files mentioned there. Also could have mentioned this is a brand new MacBook running macOS 12.0 (Monterey), with a fresh brew install, and Xcode 13.1.

Also worth noting that brew-installed commands work perfectly from my interactive shell, just not from Xcode build phase scripts. I have verified that the brew install path isn't present in $PATH, and that the script is running as my user, and the shell is zsh.

@carlocab
Copy link
Member

carlocab commented Nov 8, 2021

Does anything you set in .zshenv reach your Xcode builds?

Update: I was able to work around the issue by adding a symlink to the executable I needed in /usr/local/bin.

Try not to do too much of this, as this can confuse brew.

@gromgit
Copy link
Member

gromgit commented Nov 8, 2021

Also worth noting that brew-installed commands work perfectly from my interactive shell, just not from Xcode build phase scripts. I have verified that the brew install path isn't present in $PATH, and that the script is running as my user, and the shell is zsh.

How did you verify that last bit (that your scripts are actually run with zsh)? If you add the following lines to your build scripts:

echo "Bash: ${BASH_VERSION:-Nope}"
echo "Zsh: ${ZSH_VERSION:-Nope}"
echo "Path: $PATH"

what's the output you get when running them through Xcode?

@aimileus
Copy link
Contributor

aimileus commented Nov 8, 2021

I can successfully build and test git-annex on ARM, but there is no bottle. Could someone please start a bottling job?

@carlocab
Copy link
Member

carlocab commented Nov 8, 2021

https://github.com/Homebrew/homebrew-core/actions/runs/1434993306

@carlocab
Copy link
Member

carlocab commented Nov 8, 2021

It still fails to build, unfortunately.

@aimileus
Copy link
Contributor

aimileus commented Nov 8, 2021

This is the build log on my local M1 Air of brew install --verbose --build-bottle git-annex. Is there any useful debug information I can give?
git-annex.log

@mgrider
Copy link

mgrider commented Nov 8, 2021

Hi @gromgit, I had just used echo $SHELL (which outputs /bin/zsh even though the build phase "Shell" is configured as /bin/sh), and I had assumed that meant it was running as zsh. When I run your three commands, I get this output:

Bash: 3.2.57(1)-release
Zsh: Nope
Path: /Applications/Xcode-13.1.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode-13.1.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/bin:/Applications/Xcode-13.1.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec:/Applications/Xcode-13.1.0.app/Contents/Developer/Platforms/AppleTVSimulator.platform/usr/bin:/Applications/Xcode-13.1.0.app/Contents/Developer/Platforms/AppleTVSimulator.platform/usr/local/bin:/Applications/Xcode-13.1.0.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/usr/bin:/Applications/Xcode-13.1.0.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/usr/local/bin:/Applications/Xcode-13.1.0.app/Contents/Developer/usr/bin:/Applications/Xcode-13.1.0.app/Contents/Developer/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

...clearly indicating that perhaps the script is actually running as bash. After this revelation, I added the requisite brew eval to a .bashrc file, but it doesn't appear to have changed the $PATH output. I've heard from other folks that Xcode has always stubbornly refused to read configuration files. I think this kind of thing has worked in the past because brew installed into one of the locations in the path list above.

@gromgit
Copy link
Member

gromgit commented Nov 9, 2021

the build phase "Shell" is configured as /bin/sh

That is likely the core issue, since /bin/sh up till Big Sur (and maybe Monterey too) is actually bash with POSIX sh semantics.

Try the following in order, stopping when one of them produces the results you seek:

  1. Set the build phase "Shell" to /bin/zsh
  2. Ensure that all your build scripts start with the shebang line #!/bin/zsh
  3. Resign yourself to living with bash-as-sh, and add a brew eval line to the start of all your build scripts. This is needed because bash-as-sh invoked non-interactively won't read any startup files. (See the INVOCATION section of the bash man page for details.)

@mgrider
Copy link

mgrider commented Nov 9, 2021

Update: I was able to work around the issue by adding a symlink to the executable I needed in /usr/local/bin.

Try not to do too much of this, as this can confuse brew.

Can you say more about this? What are the possible consequences of this?

@meridsa

This comment has been minimized.

@carlocab
Copy link
Member

@meridsa that's an issue with either your network connection or system configuration. Check Homebrew/discussions#666 for related errors and solutions/workarounds.

@carlocab
Copy link
Member

Can you say more about this? What are the possible consequences of this?

I can't say too much about it, as I never really looked into it. The only thing I know is that a user did something similar and reported very weird errors from brew.

@iMichka
Copy link
Member

iMichka commented Dec 14, 2021

Can we close this? There are still formulae to be bottled; but this is better handled/tracked in homebrew-core. I think all the actions on the brew side are done.

@Bo98
Copy link
Member

Bo98 commented Dec 14, 2021

Yeah this has turned into a support forum. If anyone needs to ask a question or get help, post at https://github.com/Homebrew/discussions/discussions instead.

If anyone spots a formula which builds from source but isn't bottled, then open an issue in homebrew-core. Recent CI changes however mean we're automatically check this on every new formula version, so a lot less slip through.

@Bo98 Bo98 closed this as completed Dec 14, 2021
@Bo98 Bo98 removed the help wanted We want help addressing this label Dec 14, 2021
@Bo98 Bo98 unpinned this issue Dec 14, 2021
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests