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

🐛 [BUG] Cannot run mas on ARM-based CPU #308

Closed
1 task done
dirn opened this issue Nov 30, 2020 · 15 comments · Fixed by #310
Closed
1 task done

🐛 [BUG] Cannot run mas on ARM-based CPU #308

dirn opened this issue Nov 30, 2020 · 15 comments · Fixed by #310
Labels
Milestone

Comments

@dirn
Copy link

dirn commented Nov 30, 2020

Your Environment

  • mas version: 1.7.1
  • macOS version (system_profiler SPSoftwareDataType -detailLevel mini): 11.0.1

mas Install Method

  • brew install mas (homebrew-core)
  • [] mas-cli/tap
  • [] .pkg installer from releases
  • [] Built from source
    • Fork/branch: ? (e.g. mas-cli/master)
    • Xcode version: 10.?

Describe the Bug

I've installed mas on an M1. Whenever I try to use mas in any way, it exits with a SIGKILL. I've tried using mas under fish, bash, and zsh (both macOS-provided and through Homebrew).

To Reproduce

Steps to reproduce the behavior:

  1. Install mas on Apple Silicon
  2. Run mas at a command prompt
  3. See error

Expected Behavior

mas works

Actual Behavior

mas is killed by SIGKILL

Screenshots, Terminal Output

$ file (which mas)
/opt/homebrew/bin/mas: Mach-O 64-bit executable arm64
$ mas
fish: “mas” terminated by signal SIGKILL (Forced quit)
$ mas list
fish: “mas list” terminated by signal SIGKILL (Forced quit)
$ mas version
fish: “mas version” terminated by signal SIGKILL (Forced quit)

Additional Context

If I install mas under Rosetta 2, it works as expected. The problem is specific to native M1.

@dirn dirn added the 🐛 bug label Nov 30, 2020
@phatblat
Copy link
Member

phatblat commented Dec 1, 2020

Thanks for this. I did test building and running mas on a DTK box and it worked fine. But I need to include an arm64 slice in the binary to resolve this.

@phatblat
Copy link
Member

phatblat commented Dec 1, 2020

Actually, it may be the dependencies that are missing the arm64 slice

@MMilesMM
Copy link

MMilesMM commented Dec 2, 2020

I'll get it to install normally with the beta Build of Homebrew for Arm but when I try to run it, it gives me the following error:
zsh: killed mas

@mattmc3
Copy link

mattmc3 commented Dec 11, 2020

I can also confirm this behavior.

brew install mas works great.

But then...

mas list
[1]    6261 killed     mas list

@marijnbent
Copy link

Confirmed for me as well

@johnalanwoods
Copy link

This is maybe due to codesign rules for ARM64. All need to be at least adhoc signed.

@chris-araman
Copy link
Contributor

I suspect this is due to script/install altering the executable's rpath after code signing.

caraman@mac ~ % brew install -s mas              
==> Downloading https://homebrew.bintray.com/bottles/carthage-0.36.0.arm64_big_sur.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/a8dda58b245591307897cc3ce4f421350f319e5c9fd66ebfa8f8d45b0d031581?response-content-disposition=attachment%3Bfilename%3D%22carthage-0.36.0.arm64_bi
######################################################################## 100.0%
==> Cloning https://github.com/mas-cli/mas.git
Cloning into '/Users/caraman/Library/Caches/Homebrew/mas--git'...
==> Checking out tag v1.7.1
HEAD is now at b8dcb4c Merge pull request #300 from mas-cli/release-1.7.1
==> Installing dependencies for mas: carthage
==> Installing mas dependency: carthage
==> Pouring carthage-0.36.0.arm64_big_sur.bottle.tar.gz
==> Caveats
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
==> Summary
🍺  /opt/homebrew/Cellar/carthage/0.36.0: 8 files, 7.4MB
==> Installing mas
==> carthage bootstrap --platform macOS Commandant
==> script/install /opt/homebrew/Cellar/mas/1.7.1
🍺  /opt/homebrew/Cellar/mas/1.7.1: 23 files, 1MB, built in 41 seconds
==> Caveats
==> carthage
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
caraman@mac ~ % mas --help
zsh: killed     mas --help
caraman@mac ~ % codesign --verify --deep --verbose /opt/homebrew/bin/mas
/opt/homebrew/bin/mas: invalid signature (code or signature have been modified)
In architecture: arm64

@vtenfys
Copy link

vtenfys commented Jan 7, 2021

The MacPorts version also fails to build on my Apple Silicon MacBook due to one of its dependencies not supporting arm64

@minacle
Copy link

minacle commented Jan 14, 2021

Same here.

  • Machine: Macmini9,1
  • macOS: 20C69
mayu@robinia ~ % brew install mas
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
bpython                    dstask                     pdftilecut
==> Updated Formulae
Updated 119 formulae.
==> New Casks
pibar                      pragli                     twobird
==> Updated Casks
Updated 72 casks.

Error: mas: no bottle available!
You can try to install from source with:
  brew install --build-from-source mas
Please note building from source is unsupported. You will encounter build
failures with some formulae. If you experience any issues please create pull
requests instead of asking for help on Homebrew's GitHub, Twitter or any other
official channels.
mayu@robinia ~ % brew install --build-from-source mas
==> Downloading https://homebrew.bintray.com/bottles/carthage-0.36.0.arm64_big_s
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/a8dda58b245591307897c
######################################################################## 100.0%
==> Cloning https://github.com/mas-cli/mas.git
Cloning into '/Users/mayu/Library/Caches/Homebrew/mas--git'...
==> Checking out tag v1.7.1
HEAD is now at b8dcb4c Merge pull request #300 from mas-cli/release-1.7.1
==> Installing dependencies for mas: carthage
==> Installing mas dependency: carthage
==> Pouring carthage-0.36.0.arm64_big_sur.bottle.tar.gz
==> Caveats
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
==> Summary
🍺  /opt/homebrew/Cellar/carthage/0.36.0: 8 files, 7.4MB
==> Installing mas
==> carthage bootstrap --platform macOS Commandant
==> script/install /opt/homebrew/Cellar/mas/1.7.1
🍺  /opt/homebrew/Cellar/mas/1.7.1: 23 files, 1MB, built in 35 seconds
==> Caveats
==> carthage
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
mayu@robinia ~ % mas                              
zsh: killed     mas
mayu@robinia ~ % mas --help
zsh: killed     mas --help
mayu@robinia ~ % codesign --verify --deep --verbose /opt/homebrew/bin/mas
/opt/homebrew/bin/mas: invalid signature (code or signature have been modified)
In architecture: arm64
mayu@robinia ~ % 

@jasonjurotich
Copy link

Any news on this? mas-cli is still immediately killed on M1:

`[1]    75981 killed     mas search Xcode`

@fabriceb
Copy link

I tried your solution, @chris-araman, and it is not enough, here is what I then get;

# script/build                                                 [~/Library/Caches/Homebrew/mas--git]
Xcode 12.3
Build version 12C33
Please update to the latest Carthage version: 0.36.1. You currently are on 0.36.0
*** No cache found for Commandant, building with all downstream dependencies
*** No cache found for Nimble, building with all downstream dependencies
*** No cache found for Quick, building with all downstream dependencies
*** xcodebuild output can be found in /var/folders/lj/wwc3hgmj1fq_91mjc9knjjlm0000gn/T/carthage-xcodebuild.ZzTsFa.log
*** Building scheme "Commandant" in Commandant.xcworkspace
*** Building scheme "Nimble-macOS" in Nimble.xcodeproj
*** Building scheme "Quick-macOS" in Quick.xcworkspace
==> 📦 Archiving mas (1.7.1)
objc[63373]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x2105538f0) and ?? (0x1142842b8). One of the two will be used. Which one is undefined.
objc[63373]: Class AMSupportURLSession is implemented in both ?? (0x210553940) and ?? (0x114284308). One of the two will be used. Which one is undefined.

❌  error: The linked and embedded framework 'Commandant.framework' is missing one or more architectures required by this target: arm64. (in target 'MasKit' from project 'mas-cli')


** ARCHIVE FAILED **

It seems we will also need to wait for Commandant.framework to release an arm64 version...

@fabriceb
Copy link

OK I have found I also needed to remove all references to VALID_ARCH, the corresponding pull request is here: #314

@fabriceb
Copy link

Bad news, even though I rebuilt everything taking into account @chris-araman's work, as described in #314, the binary still crashes...

@chris-araman
Copy link
Contributor

Thanks for digging in @fabriceb. I worried my change wasn't sufficient.

@phatblat
Copy link
Member

Fix due out soon in mas 1.8

@phatblat phatblat added this to the 1.8 milestone Feb 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.