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

macOS: "Cypress" is damaged and can't be opened. You should move it to the Trash. #24822

Closed
karlhorky opened this issue Nov 25, 2022 · 10 comments
Assignees

Comments

@karlhorky
Copy link
Contributor

karlhorky commented Nov 25, 2022

Current behavior

Hi there! 👋 Thanks for your continued effort on Cypress, really helpful for testing!

The Cypress binary with [email protected] (11.2.0.1936146) causes an error on macOS 13.0.1 (22A400) (with M1 Apple Silicon):

“Cypress” is damaged and can’t be opened. You should move it to the Trash.

Screenshot 2022-11-25 at 16 17 58

$ yarn cypress open --e2e --browser chrome
It looks like this is your first time using Cypress: 11.2.0


Cypress failed to start.

This may be due to a missing library or dependency. https://on.cypress.io/required-dependencies

Please refer to the error below for more details.

----------

Command was killed with SIGKILL (Forced termination): /Users/k/Library/Caches/Cypress/11.2.0/Cypress.app/Contents/MacOS/Cypress --no-sandbox --smoke-test --ping=673

----------

Platform: darwin-arm64 (22.1.0)
Cypress Version: 11.2.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "cy" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /opt/homebrew/Cellar/node@18/18.12.1/bin/node
Arguments: /opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js test
Directory: /Users/k/p/courses/packages/fusion.upleveled.io
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Desired behavior

Cypress should not crash and present a security warning on macOS.

Test code to reproduce

Any test code

Cypress Version

11.2.0

Node version

18.12.1

Operating System

macOS 13.0.1 (22A400)

Debug Logs

cypress:cli:cli cli starts with arguments ["/opt/homebrew/Cellar/node@18/18.12.1/bin/node","/Users/k/p/courses/packages/fusion.upleveled.io/node_modules/.bin/cypress","open","--e2e","--browser","chrome"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli:cli program parsing arguments +0ms
  cypress:cli:cli opening Cypress +1ms
  cypress:cli parsed cli options { browser: 'chrome', e2e: true } +42ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +0ms
  cypress:cli checking if executable exists /Users/k/Library/Caches/Cypress/11.2.0/Cypress.app/Contents/MacOS/Cypress +2ms
  cypress:cli Binary is executable? : true +1ms
  cypress:cli binaryDir is  /Users/k/Library/Caches/Cypress/11.2.0/Cypress.app +0ms
  cypress:cli Reading binary package.json from: /Users/k/Library/Caches/Cypress/11.2.0/Cypress.app/Contents/Resources/app/package.json +0ms
  cypress:cli Found binary version 11.2.0 installed in: /Users/k/Library/Caches/Cypress/11.2.0/Cypress.app +2ms
  cypress:cli could not read binary_state.json file at "/Users/k/Library/Caches/Cypress/11.2.0/binary_state.json" +3ms
  cypress:cli {} +0ms
  cypress:cli is Verified ? undefined +1ms
  cypress:cli running binary verification check 11.2.0 +0ms
It looks like this is your first time using Cypress: 11.2.0


  cypress:cli clearing out the verified version +3ms
  cypress:cli needs Xvfb? false +0ms
  cypress:cli spawning, should retry on display problem? false +0ms
  cypress:cli disabling Electron sandbox +0ms
  cypress:cli running smoke test +0ms
  cypress:cli using Cypress executable /Users/k/Library/Caches/Cypress/11.2.0/Cypress.app/Contents/MacOS/Cypress +0ms
  cypress:cli smoke test command: /Users/k/Library/Caches/Cypress/11.2.0/Cypress.app/Contents/MacOS/Cypress --no-sandbox --smoke-test --ping=455 +0ms
  cypress:cli smoke test timeout 30000 ms +0ms
  cypress:cli Smoke test failed: Error: Command was killed with SIGKILL (Forced termination): /Users/k/Library/Caches/Cypress/11.2.0/Cypress.app/Contents/MacOS/Cypress --no-sandbox --smoke-test --ping=455
    at makeError (/Users/k/p/courses/node_modules/cypress/node_modules/execa/lib/error.js:59:11)
    at handlePromise (/Users/k/p/courses/node_modules/cypress/node_modules/execa/index.js:114:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  shortMessage: 'Command was killed with SIGKILL (Forced termination): /Users/k/Library/Caches/Cypress/11.2.0/Cypress.app/Contents/MacOS/Cypress --no-sandbox --smoke-test --ping=455',
  command: '/Users/k/Library/Caches/Cypress/11.2.0/Cypress.app/Contents/MacOS/Cypress --no-sandbox --smoke-test --ping=455',
  exitCode: undefined,
  signal: 'SIGKILL',
  signalDescription: 'Forced termination',
  stdout: '',
  stderr: '',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
} +7s
  cypress:cli error message: Command was killed with SIGKILL (Forced termination): /Users/k/Library/Caches/Cypress/11.2.0/Cypress.app/Contents/MacOS/Cypress --no-sandbox --smoke-test --ping=455 +2ms

Cypress failed to start.

This may be due to a missing library or dependency. https://on.cypress.io/required-dependencies

Please refer to the error below for more details.

----------

Command was killed with SIGKILL (Forced termination): /Users/k/Library/Caches/Cypress/11.2.0/Cypress.app/Contents/MacOS/Cypress --no-sandbox --smoke-test --ping=455

----------

Platform: darwin-arm64 (22.1.0)
Cypress Version: 11.2.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "cy" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /opt/homebrew/Cellar/node@18/18.12.1/bin/node
Arguments: /opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js test
Directory: /Users/k/p/courses/packages/fusion.upleveled.io
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command

Workaround

Open System Settings (System Preferences on pre-Ventura macOS versions) and navigate to Privacy & Security (Security & Privacy on pre-Ventura macOS versions). Here you will see a button to allow Cypress to open anyway, even though it was not signed by a verified developer. Full instructions: #24822 (comment)

Other

No response

@nikepol
Copy link

nikepol commented Nov 28, 2022

Hi, simply go to Privacy settings on macOS and allow Cypress to start

@karlhorky
Copy link
Contributor Author

karlhorky commented Nov 28, 2022

Thanks for this workaround, I've added full instructions below and linked to it to my post above.

Workaround

Open System Settings (System Preferences on pre-Ventura macOS versions) and navigate to Privacy & Security (Security & Privacy on pre-Ventura macOS versions).

Here you will see a button to allow Cypress to open anyway, even though it was not signed by a verified developer:

Then try starting Cypress again, and choose "Open" from the prompt:

@karlhorky
Copy link
Contributor Author

This is still a problem that should still be fixed by the Cypress team though - probably the signing needs to be updated on the binary, similarly to the process @bahmutov was referring to in #8299 . (although it is probably not the same cause - I'm assuming binary signing isn't completely broken like it was in #8299)

@flotwig
Copy link
Contributor

flotwig commented Nov 28, 2022

From CI logs, it does look like the 11.2.0 build was signed correctly for darwin-arm64: https://app.circleci.com/pipelines/github/cypress-io/cypress/46080/workflows/c926334b-600d-4d64-af67-475c67796662/jobs/1937444?invite=true#step-112-2997

The Cypress code signing cert is still valid through 2024/12/11, so it's not a cert expiration issue.

@chrisbreiding tried reproducing this on Monterey with Cy 11.2.0 but was unable to. I'm going to update my Mac to Ventura and see if I can repro then.

There were some changes to code signing in Ventura, I don't see how these would impact Cypress, but maybe it's something related: https://eclecticlight.co/2022/06/17/app-security-changes-coming-in-ventura/

@nikepol Were you also encountering this issue? If so, what version of OSX are you on?

@flotwig
Copy link
Contributor

flotwig commented Nov 28, 2022

Hmm, I am not able to reproduce on M1 with macOS 13.0.1 and Cypress 11.2.0. codesign -dv --verbose=4 shows the App as appropriately signed:
image

@karlhorky Can you try running codesign -dv --verbose=4 /path/to/Cypress.app and sharing the output here?

@karlhorky
Copy link
Contributor Author

karlhorky commented Nov 28, 2022

Sure - keep in mind that this is after I performed the workaround above.

$ codesign -dv --verbose=4 /Users/k/Library/Caches/Cypress/11.2.0/Cypress.app
Executable=/Users/k/Library/Caches/Cypress/11.2.0/Cypress.app/Contents/MacOS/Cypress
Identifier=com.electron.cypress
Format=app bundle with Mach-O thin (arm64)
CodeDirectory v=20500 size=768 flags=0x10000(runtime) hashes=13+7 location=embedded
VersionPlatform=1
VersionMin=720896
VersionSDK=787200
Hash type=sha256 size=32
CandidateCDHash sha256=29788b6a4613dafcc761369d34aaa70a854b5d8f
CandidateCDHashFull sha256=29788b6a4613dafcc761369d34aaa70a854b5d8f6fd1fa5cfda35abbaee38924
Hash choices=sha256
CMSDigest=29788b6a4613dafcc761369d34aaa70a854b5d8f6fd1fa5cfda35abbaee38924
CMSDigestType=2
Executable Segment base=0
Executable Segment limit=16384
Executable Segment flags=0x1
Page size=4096
Launch Constraints:
	None
CDHash=29788b6a4613dafcc761369d34aaa70a854b5d8f
Signature size=8982
Authority=Developer ID Application: Cypress.Io, Inc. (7D655LWGLY)
Authority=Developer ID Certification Authority
Authority=Apple Root CA
Timestamp=22.11.2022 at 08:52:14
Info.plist entries=30
TeamIdentifier=7D655LWGLY
Runtime Version=12.3.0
Sealed Resources version=2 rules=13 files=16041
Internal requirements count=1 size=180

@flotwig
Copy link
Contributor

flotwig commented Nov 28, 2022

Hmm. I found this issue on Electron's repo: electron/electron#35524 Seems related, a user is indicating that it only happens on arm64 for some reason. But apparently not all arm64 machines, since it worked fine for me...

Is this your first time using Cypress on this machine?

Is there any special security config on your machine? MDM, anti-virus...?

I'm not super familiar with how macOS validates code signing, so I'm not sure where else to look for why this is happening.

@karlhorky
Copy link
Contributor Author

Is this your first time using Cypress on this machine?

Is there any special security config on your machine? MDM, anti-virus...?

Not first time, I've used about 10 or 15 different versions before this with no issues. And no special security config...

@karlhorky
Copy link
Contributor Author

Just upgraded to [email protected] and also received the same problem (on macOS Ventura 13.0.1 (22A400) on an M1 machine):

Screenshot 2022-12-10 at 10 38 02

Running the codesign command before allowing the binary in Privacy & Security results in this:

$ codesign -dv --verbose=4 /Users/k/Library/Caches/Cypress/12.0.2/Cypress.app
Executable=/Users/k/Library/Caches/Cypress/12.0.2/Cypress.app/Contents/MacOS/Cypress
Identifier=com.electron.cypress
Format=app bundle with Mach-O thin (arm64)
CodeDirectory v=20500 size=768 flags=0x10000(runtime) hashes=13+7 location=embedded
VersionPlatform=1
VersionMin=720896
VersionSDK=787200
Hash type=sha256 size=32
CandidateCDHash sha256=8e79505e453984aede96ba15ad0dfa66ab2136ed
CandidateCDHashFull sha256=8e79505e453984aede96ba15ad0dfa66ab2136ed20f7254308c7218af2063256
Hash choices=sha256
CMSDigest=8e79505e453984aede96ba15ad0dfa66ab2136ed20f7254308c7218af2063256
CMSDigestType=2
Executable Segment base=0
Executable Segment limit=16384
Executable Segment flags=0x1
Page size=4096
Launch Constraints:
	None
CDHash=8e79505e453984aede96ba15ad0dfa66ab2136ed
Signature size=8982
Authority=Developer ID Application: Cypress.Io, Inc. (7D655LWGLY)
Authority=Developer ID Certification Authority
Authority=Apple Root CA
Timestamp=08.12.2022 at 17:00:36
Info.plist entries=30
TeamIdentifier=7D655LWGLY
Runtime Version=12.3.0
Sealed Resources version=2 rules=13 files=16024
Internal requirements count=1 size=180

@flotwig flotwig assigned flotwig and unassigned flotwig Dec 20, 2022
@flotwig
Copy link
Contributor

flotwig commented Feb 6, 2023

Since we haven't had any more reports, and this issue appears to be isolated to 1 user, and it's unclear how we could proceed with resolving this for you, I'm going to close this for now. Will re-open if this ends up being a bigger issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants