-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: add support for apple silicon #70
Conversation
4408cfb
to
f58a826
Compare
* update prompt-install to detect and handle prompt installation for apple silicon (arm64e) architecture * install homebrew used to manage rosetta 2 installations (x86_64) in /usr/local * install homebrew used to manage native installations (arm64e) in /opt/homebrew * introduce `brew-intel` and `brew-arm` aliases to enable management of both installations regardless of the architecture of the current shell * update `use-shell` to detect arm64e native shells * fix an issue where the PATH variable is reordered by invalid path_helper invocations * normalise and fix areas where the PATH variable is modified * normalise eval invocations (such as completions) * remove completion check for gulp and grunt, which are largely obsolete * fix an issue where it was assumed that gpg was available * add end-to-end tests for Windows 2019 under WSL 1 * add end-to-end tests for all validated linux distributions - create a non-root user - add user to sudoers - install gosu - use gosu to invoke installs and tests under non-root user * update VERSION logic in prompt-install / update to support the `next` branch and any future branches - this should be improved in the future to correctly recommend updates based on semver tags (or the branch/channel used to install prompt) Closes: automotiveMastermind#66, automotiveMastermind#69 NOTE: Homebrew, which we rely heavily on, does not yet officially support apple silicon. In addition, very few formulae include bottles (pre-compiled) binaries for the SoC. As a result, most formulae must be compiled from source. Many formulae do not yet successfully compile for apple silicon and so we must gracefully fallback to their x86_64 counterparts. The following methodology is used to support prompt on apple silicon macs: 1. install homebrew instance for intel/rosetta (x86_64) under /usr/local 2. detect apple silicon (arm64e) and install homebrew instance in /opt/homebrew 3. attempt to install all tools included with prompt natively in /opt/homebrew 4. install all tools included with prompt under rosetta in /usr/local 5. ensure /opt/homebrew is prioritised in the PATH variable The above methodology will enable native tools if and when they are available and working with apple silicon. Tools that are not available and/or fail will fallback to the rosetta versions. This enables a seamless experience for apple silicon users.
@sjk07 @patrickserrano : all scenarios are now passing including tests across all platforms! Let me know if you see anything that needs to be addressed. Also, evidence that prompt works perfectly on apple silicon both natively and in rosetta 2: NOTE: at present prompt will always default to using native apps over rosetta counterparts, which is why the fully-qualified paths to /usr/local/bin are being used. I have yet to run into an issue with any app that successfully compiles for arm64e so defaulting to native seems to be best for performance. |
@@ -35,37 +35,81 @@ jobs: | |||
- name: checkout | |||
uses: actions/checkout@v2 | |||
- name: install-bash | |||
run: ./install.sh bash | tee log.txt && bash -lc 'cat $AM_PROMPT/.sha' | |||
run: ./hack/install.sh bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmccaffery Why chose the name hack, I'm curious?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't actually understand the reasons for this, but its a growing trend in many of the OSS projects I participate in, mostly in the golang world. Probably a direct result of Kubernetes doing it:
@dmccaffery this is awesome stuff! I don't have an M1 chip so you're going to have to be the sole maintainer for this stuff atm 😄 @patrickserrano Is there anything WSL side locally that you want to check? Also we should add some of the new functionality to the readme / #63 if not then... LGTM! |
I added a test for the issue Patrick saw as well as a WSL 1 e2e build, so I think it's fully resolved. If someone on Windows wants to validate that, I'd be happy. :) |
🎉 This PR is included in version 8.2.0-next.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
apple silicon (arm64e) architecture
/usr/local
/opt/homebrew
brew-intel
andbrew-arm
aliases to enable management ofboth installations regardless of the architecture of the current shell
use-shell
to detect arm64e native shellspath_helper invocations
next
branch and any future branches
based on semver tags (or the branch/channel used to install prompt)
Closes: #61, #64, #66, #69
NOTE:
Homebrew, which we rely heavily on, does not yet officially support
apple silicon. In addition, very few formulae include bottles (pre-compiled)
binaries for the SoC. As a result, most formulae must be compiled from
source. Many formulae do not yet successfully compile for apple silicon
and so we must gracefully fallback to their x86_64 counterparts.
The following methodology is used to support prompt on apple silicon
macs:
/opt/homebrew
/opt/homebrew
The above methodology will enable native tools if and when they are
available and working with apple silicon. Tools that are not available
and/or fail will fallback to the rosetta versions. This enables a
seamless experience for apple silicon users.