question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

macOS 12.3 Beta has removed the Python 2 support: spawn /usr/bin/python ENOENT

See original GitHub issue
  • Electron-Builder Version: 22.13.1
  • Node Version: v16.13.1
  • Electron Version: 16.0.8
  • Electron Type (current, beta, nightly): current
  • electron-updater Version: 4.6.5
  • Target: macOS (x86, ARM64, universal?)

macOS 12.3 has removed the Python 2 support; thus, /usr/bin/python has been removed. electron-builder tries to call /usr/bin/python and it throws Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT.

Reproducible Step

# Clone the minimum reproducible boilerplate
git clone git@github.com:electron-react-boilerplate/electron-react-boilerplate.git
cd electron-react-boilerplate

# Install dependencies
npm i

# Upgrade to the latest patch version
npm upgrade

# Package (it throws here)
npm run package

Full Log

$ npm run package
> package
> ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never


> build
> concurrently "npm run build:main" "npm run build:renderer"

[1]
[1] > build:renderer
[1] > cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.prod.ts
[1]
[0]
[0] > build:main
[0] > cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.prod.ts
[0]
[1] npm run build:renderer exited with code 0
[0] npm run build:main exited with code 0
  • electron-builder  version=22.13.1 os=21.4.0
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=release/build/builder-effective-config.yaml
  • installing production dependencies  platform=darwin arch=arm64 appDir=/Users/pan93412/Projects/electron-react-boilerplate/release/app
  • packaging       platform=darwin arch=arm64 electron=16.0.8 appOutDir=release/build/mac-arm64
  • downloading     url=https://github.com/electron/electron/releases/download/v16.0.8/electron-v16.0.8-darwin-arm64.zip size=88 MB parts=8
  • downloaded      url=https://github.com/electron/electron/releases/download/v16.0.8/electron-v16.0.8-darwin-arm64.zip duration=22.373s
  • skipped macOS application code signing  reason=cannot find valid "Developer ID Application" identity or custom non-Apple code signing certificate, see https://electron.build/code-signing allIdentities=     0 identities found
                                                Valid identities only
     0 valid identities found
Skipping notarizing step. Packaging is not running in CI
  • building        target=macOS zip arch=arm64 file=release/build/ElectronReact-4.5.0-arm64-mac.zip
  • building        target=DMG arch=arm64 file=release/build/ElectronReact-4.5.0-arm64.dmg
  • installing production dependencies  platform=darwin arch=x64 appDir=/Users/pan93412/Projects/electron-react-boilerplate/release/app
  • Detected arm64 process, HFS+ is unavailable. Creating dmg with APFS - supports Mac OSX 10.12+
  • packaging       platform=darwin arch=x64 electron=16.0.8 appOutDir=release/build/mac
  • downloading     url=https://github.com/electron/electron/releases/download/v16.0.8/electron-v16.0.8-darwin-x64.zip size=83 MB parts=8
  • downloaded      url=https://github.com/electron/electron/releases/download/v16.0.8/electron-v16.0.8-darwin-x64.zip duration=19.803s
  • skipped macOS application code signing  reason=cannot find valid "Developer ID Application" identity or custom non-Apple code signing certificate, see https://electron.build/code-signing allIdentities=     0 identities found
                                                Valid identities only
     0 valid identities found
Skipping notarizing step. Packaging is not running in CI
  • building        target=macOS zip arch=x64 file=release/build/ElectronReact-4.5.0-mac.zip
  • building        target=DMG arch=x64 file=release/build/ElectronReact-4.5.0.dmg
  • Detected arm64 process, HFS+ is unavailable. Creating dmg with APFS - supports Mac OSX 10.12+
  ⨯ Exit code: ENOENT. spawn /usr/bin/python ENOENT  failedTask=build stackTrace=Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT
    at /Users/pan93412/Projects/electron-react-boilerplate/node_modules/builder-util/src/util.ts:133:18
    at exithandler (node:child_process:404:5)
    at ChildProcess.errorhandler (node:child_process:416:5)
    at ChildProcess.emit (node:events:390:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
  • Above command failed, retrying 5 more times
  • building block map  blockMapFile=release/build/ElectronReact-4.5.0-arm64-mac.zip.blockmap
  • Above command failed, retrying 4 more times
  • Above command failed, retrying 3 more times
  • Above command failed, retrying 2 more times
  • Above command failed, retrying 1 more times
  • Above command failed, retrying 0 more times
  • building block map  blockMapFile=release/build/ElectronReact-4.5.0-mac.zip.blockmap

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:23 (4 by maintainers)

github_iconTop GitHub Comments

35reactions
Tenpicommented, Mar 9, 2022

Ok, it’s working again in version 23.0.2, thanks.

11reactions
rogeriomqcommented, Apr 7, 2022

Hi, on MacOS 12.3.1 Chip M1 Pro, I did the following procedures: 1 - Use ASDF to install python v2: asdf install python 2.7.18 2 - Set Python on shell with asdf: asdf shell python 2.7.18 3 - Export PYTHON_PATH environment: export PYTHON_PATH=/Users/YOUR_USER/.asdf/shims/python

Bingo! Now I can create the .DMG again.

Hope this helps someone else who has gone through this too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

macOS Monterey 12.3 will remove Python 2.7 (/usr/bin/python)
Hot on the heels of macOS Monterey 12.2, Apple have publicly released the macOS Monterey 12.3 Beta Release Notes. Despite this being a...
Read more >
Python 2.7 is removed from macOS in version 12.3+ - Issuehunt
Apple states: "Python 2.7 was removed from macOS in this update. ... Exit code: ENOENT. spawn /usr/bin/python ENOENT failedTask=build stackTrace=Error: Exit ...
Read more >
Apple Finally Removing Python 2 in macOS 12.3 - MacRumors
Apple will no longer bundle Python 2.7 with macOS 12.3, according to developer release notes for the upcoming software update. Python 2 has...
Read more >
Apple removes Python 2 in macOS Monterey. What now? - Jamf
Apple has been warning that the Python 2 binary will be removed. It's a fact now. Read what to do next.
Read more >
macOS Monterey 12.3 removes Python 2 – Link collection
As it turns out, the readlink command (which tells you where a symbolic link points to) got an update in macOS 12.3 and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found