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

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.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 15
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Fix due out soon in mas 1.8

I can also confirm this behavior.

brew install mas works great.

But then…

mas list
[1]    6261 killed     mas list

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

Confirmed for me as well

OK I have found I also needed to remove all references to VALID_ARCH, the corresponding pull request is here: https://github.com/mas-cli/mas/pull/314

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…

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