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

Allow ARM on macOS #373

Merged
merged 5 commits into from
Dec 28, 2020
Merged

Allow ARM on macOS #373

merged 5 commits into from
Dec 28, 2020

Conversation

fxcoudert
Copy link
Member

Although we're not entirely there yet, the time for Apple Silicon support is nearing. I've had a look at the installer script to see what is needed there.

@fxcoudert
Copy link
Member Author

Around line 425, there is:

directories=(bin etc include lib sbin share var opt
             share/zsh share/zsh/site-functions
             var/homebrew var/homebrew/linked
             Cellar Caskroom Homebrew Frameworks)
mkdirs=()
for dir in "${directories[@]}"; do
  if ! [[ -d "${HOMEBREW_PREFIX}/${dir}" ]]; then
    mkdirs+=("${HOMEBREW_PREFIX}/${dir}")
  fi
done

I think the Homebrew directory here is an error. HOMEBREW_REPOSITORY should be created with a different logic.

@fxcoudert
Copy link
Member Author

Running this version on Apple Silicon currently fails because we're not giving /opt/homebrew the right ownership. It gets root:wheel, which is not appropriate. Whatever else happens, we always need to be owners of HOMEBREW_REPOSITORY.

brewadmin@administrators-Mac-5 ~ % bash ./install.sh    
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
==> The following new directories will be created:
/opt/homebrew/bin
/opt/homebrew/etc
/opt/homebrew/include
/opt/homebrew/lib
/opt/homebrew/sbin
/opt/homebrew/share
/opt/homebrew/var
/opt/homebrew/opt
/opt/homebrew/share/zsh
/opt/homebrew/share/zsh/site-functions
/opt/homebrew/var/homebrew
/opt/homebrew/var/homebrew/linked
/opt/homebrew/Cellar
/opt/homebrew/Caskroom
/opt/homebrew/Homebrew
/opt/homebrew/Frameworks

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew
==> /usr/bin/sudo /usr/sbin/chown root:wheel /opt/homebrew
==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Homebrew /opt/homebrew/Frameworks
==> /usr/bin/sudo /bin/chmod g+rwx /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Homebrew /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/sbin/chown brewadmin /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Homebrew /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Homebrew /opt/homebrew/Frameworks
==> Downloading and installing Homebrew...
/opt/homebrew/.git: Permission denied
Failed during: git init -q

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far!

install.sh Outdated Show resolved Hide resolved
@MikeMcQuaid
Copy link
Member

I think the Homebrew directory here is an error. HOMEBREW_REPOSITORY should be created with a different logic.

Yes, that could reference HOMEBREW_REPOSITORY if needed or just be removed perhaps.

@fxcoudert
Copy link
Member Author

I've tested on ARM and Intel macOS. I'd like to have some Linux testing, but otherwise I think this is complete and ready for review.

@sjackman
Copy link
Member

I'd like to have some Linux testing, but otherwise I think this is complete and ready for review.

I gave it a quick test on Linux in /home/linuxbrew/.linuxbrew with and without sudo available, and it worked for me.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Let's hold off merging until we're able to announce we "support" this (i.e. we have a non-trivial number of bottles).

@billinghamj
Copy link

billinghamj commented Dec 17, 2020

I think this is great, as really a shockingly large amount of stuff "just works" now - it's really impressive how fast that has happened.

But I wonder if you might want to consider describing it as more partial support, or support with significant caveats? As some not-insignificant proportion of formulae will likely not be compatible for a long time, if ever. So setting user expectations in some form may help?

@MikeMcQuaid
Copy link
Member

But I wonder if you might want to consider describing it as more partial support, or support with significant caveats? As some not-insignificant proportion of formulae will likely not be compatible for a long time, if ever. So setting user expectations in some form may help?

Yup, that's the plan before we'd merge this 👍🏻

@fxcoudert
Copy link
Member Author

We have passed 1000 ARM bottles, and I would like to merge this and enable ARM testing on CI: Homebrew/homebrew-core#67577

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we print some sort of disclaimer that there's still a lot of packages missing bottles and recommend Rosetta 2 for now? What's the state of brew doctor on a default ARM setup; might want to address/add to that too?

@fxcoudert
Copy link
Member Author

Re. brew doctor: Homebrew/brew#10132

@MikeMcQuaid
Copy link
Member

Re. brew doctor: Homebrew/brew#10132

👍🏻 to merge once that's merged.

@fxcoudert
Copy link
Member Author

👍🏻 to merge once that's merged

@MikeMcQuaid I believe we need a version shipped, otherwise people will get brew doctor complaints

@fxcoudert
Copy link
Member Author

I've opened a brew issue tracking Apple Silicon support, and stating our current level of support, here: Homebrew/brew#10152

@richiksc
Copy link

There's a new brew version released now with Homebrew/brew#10132 included. Can this be merged now?

@fxcoudert fxcoudert merged commit c2cfecf into master Dec 28, 2020
@fxcoudert fxcoudert deleted the arm branch December 28, 2020 21:19
@fievelk
Copy link

fievelk commented Dec 30, 2020

Just a quick note: since this PR got merged, I think it would be good to update the first lines of the instructions on https://docs.brew.sh/Installation (they only mention /usr/local for the script installation, while /opt/homebrew is also available now).

@fxcoudert
Copy link
Member Author

@fievelk indeed, thank you for noticing! Homebrew/brew#10182

@charliegroll
Copy link

@fievelk @fxcoudert it also says that a 64-bit Intel CPU is required 😉

@fxcoudert
Copy link
Member Author

@charliegroll my pull request also changes that part: Homebrew/brew#10182

@nickoe
Copy link

nickoe commented Jan 9, 2021

@fxcoudert Why does the HOMEBREW_PREFIX need to be different depending on arch?

@fxcoudert
Copy link
Member Author

@nickoe see Homebrew/brew#9177

@nickoe
Copy link

nickoe commented Jan 9, 2021

@fxcoudert That issue does not really talk about why. I guess the closest answer is Homebrew/brew#9130 (comment)

But as lenlo mentions:

[...]
I am less happy with the heavy handed way /opt/homebrew suddenly got usurped for ARM binaries only -- even on x86 systems that will never have any ARM binaries on them.
[...]

But yet, that does not explain why they prefixes has to be different.

@fxcoudert
Copy link
Member Author

In the initial phase of Apple Silicon migration, in order to avoid using the same prefix for both Intel and ARM binaries, we have two prefixes instead: /usr/local for Intel, and /opt/homebrew for Apple Silicon

Basically because not everything supports Apple Silicon, we need to have coexisting installations for Rosetta and native. Hence we cannot use /usr/local for ARM

@nickoe
Copy link

nickoe commented Jan 9, 2021

@fxcoudert but couldn't hat just be a subdir in the prefix?

@sjackman
Copy link
Member

A subdirectory like /usr/local/arm was one of proposals considered, but /opt/homebrew was preferred by the majority.

@richiksc
Copy link

Off-topic, but I prefer /opt/homebrew as well, because it creates separation between binaries installed by Homebrew, and binaries installed manually to /usr/local/bin. If I ever wanted to delete all Homebrew installed binaries or in fact Homebrew itself, I can easily run rm -rf /opt/homebrew[/bin] without worrying about anything else installed to /usr/local.

@sjackman
Copy link
Member

Homebrew on Linux uses /home/linuxbrew/.linuxbrew as the default prefix for this reason among others.

@Homebrew Homebrew locked as resolved and limited conversation to collaborators Jan 10, 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

Successfully merging this pull request may close these issues.

8 participants