1"use strict";(self.webpackChunkelectronjs=self.webpackChunkelectronjs||[]).push([["11316"],{52170(e,i,t){t.r(i),t.d(i,{metadata:()=>n,default:()=>u,frontMatter:()=>s,contentTitle:()=>l,toc:()=>a,assets:()=>c});var n=JSON.parse('{"id":"latest/development/build-instructions-macos","title":"Build Instructions (macOS)","description":"Follow the guidelines below for building **Electron itself** on macOS, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the application distribution guide.","source":"@site/docs/latest/development/build-instructions-macos.md","sourceDirName":"latest/development","slug":"/latest/development/build-instructions-macos","permalink":"/docs/latest/development/build-instructions-macos","draft":false,"unlisted":false,"editUrl":"https://github.com/electron/electron/edit/main/docs/development/build-instructions-macos.md","tags":[],"version":"current","frontMatter":{"title":"Build Instructions (macOS)","description":"Follow the guidelines below for building **Electron itself** on macOS, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the application distribution guide.","slug":"build-instructions-macos","hide_title":false},"sidebar":"docs","previous":{"title":"Build Instructions (Linux)","permalink":"/docs/latest/development/build-instructions-linux"},"next":{"title":"Build Instructions (Windows)","permalink":"/docs/latest/development/build-instructions-windows"}}'),r=t(74848),o=t(28453);let s={title:"Build Instructions (macOS)",description:"Follow the guidelines below for building **Electron itself** on macOS, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the application distribution guide.",slug:"build-instructions-macos",hide_title:!1},l="Build Instructions (macOS)",c={},a=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Arm64-specific prerequisites",id:"arm64-specific-prerequisites",level:3},{value:"Building Electron",id:"building-electron",level:2},{value:"Troubleshooting",id:"troubleshooting",level:2},{value:"Xcode "incompatible architecture" errors (MacOS arm64-specific)",id:"xcode-incompatible-architecture-errors-macos-arm64-specific",level:3},{value:"Certificates fail to verify",id:"certificates-fail-to-verify",level:3}];function d(e){let i={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.header,{children:(0,r.jsx)(i.h1,{id:"build-instructions-macos",children:"Build Instructions (macOS)"})}),"\n",(0,r.jsxs)(i.p,{children:["Follow the guidelines below for building ",(0,r.jsx)(i.strong,{children:"Electron itself"})," on macOS, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the ",(0,r.jsx)(i.a,{href:"/docs/latest/tutorial/application-distribution",children:"application distribution"})," guide."]}),"\n",(0,r.jsx)(i.h2,{id:"prerequisites",children:"Prerequisites"}),"\n",(0,r.jsxs)(i.ul,{children:["\n",(0,r.jsx)(i.li,{children:"macOS >= 12"}),"\n",(0,r.jsxs)(i.li,{children:[(0,r.jsx)(i.a,{href:"https://developer.apple.com/technologies/tools/",children:"Xcode"}),". The exact version\nneeded depends on what branch you are building, but the latest version of\nXcode is generally a good bet for building ",(0,r.jsx)(i.code,{children:"main"}),"."]}),"\n",(0,r.jsx)(i.li,{children:"Python >= 3.9"}),"\n",(0,r.jsxs)(i.li,{children:[(0,r.jsx)(i.a,{href:"https://nodejs.org/download/",children:"Node.js"})," >= 22.18.0"]}),"\n"]}),"\n",(0,r.jsx)(i.h3,{id:"arm64-specific-prerequisites",children:"Arm64-specific prerequisites"}),"\n",(0,r.jsxs)(i.ul,{children:["\n",(0,r.jsxs)(i.li,{children:["Rosetta 2","\n",(0,r.jsxs)(i.ul,{children:["\n",(0,r.jsx)(i.li,{children:"We recommend installing Rosetta if using dependencies that need to cross-compile on x64 and arm64 machines. Rosetta can be installed by using the softw
1areupdate command line tool."}),"\n",(0,r.jsx)(i.li,{children:(0,r.jsx)(i.code,{children:"$ softwareupdate --install-rosetta"})}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(i.h2,{id:"building-electron",children:"Building Electron"}),"\n",(0,r.jsxs)(i.p,{children:["See ",(0,r.jsx)(i.a,{href:"/docs/latest/development/build-instructions-gn",children:"Build Instructions: GN"}),"."]}),"\n",(0,r.jsx)(i.h2,{id:"troubleshooting",children:"Troubleshooting"}),"\n",(0,r.jsx)(i.h3,{id:"xcode-incompatible-architecture-errors-macos-arm64-specific",children:'Xcode "incompatible architecture" errors (MacOS arm64-specific)'}),"\n",(0,r.jsxs)(i.p,{children:["If both Xcode and Xcode command line tools are installed (",(0,r.jsx)(i.code,{children:"$ xcode -select --install"}),", or directly download the correct version ",(0,r.jsx)(i.a,{href:"https://developer.apple.com/download/all/?q=command%20line%20tools",children:"here"}),"), but the stack trace says otherwise like so:"]}),"\n",(0,r.jsx)(i.pre,{children:(0,r.jsx)(i.code,{className:"language-sh",children:"xcrun: error: unable to load libxcrun\n(dlopen(/Users/<user>/.electron_build_tools/third_party/Xcode/Xcode.app/Contents/Developer/usr/lib/libxcrun.dylib (http://xcode.app/Contents/Developer/usr/lib/libxcrun.dylib), 0x0005):\n tried: '/Users/<user>/.electron_build_tools/third_party/Xcode/Xcode.app/Contents/Developer/usr/lib/libxcrun.dylib (http://xcode.app/Contents/Developer/usr/lib/libxcrun.dylib)'\n (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))), '/Users/<user>/.electron_build_tools/third_party/Xcode/Xcode-11.1.0.app/Contents/Developer/usr/lib/libxcrun.dylib (http://xcode-11.1.0.app/Contents/Developer/usr/lib/libxcrun.dylib)' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))).`\n"})}),"\n",(0,r.jsxs)(i.p,{children:["If you are on arm64 architecture, the build script may be pointing to the wrong Xcode version (11.x.y doesn't support arm64). Navigate to ",(0,r.jsx)(i.code,{children:"/Users/<user>/.electron_build_tools/third_party/Xcode/"})," and rename ",(0,r.jsx)(i.code,{children:"Xcode-13.3.0.app"})," to ",(0,r.jsx)(i.code,{children:"Xcode.app"})," to ensure the right Xcode version is used."]}),"\n",(0,r.jsx)(i.h3,{id:"certificates-fail-to-verify",children:"Certificates fail to verify"}),"\n",(0,r.jsxs)(i.p,{children:["Installing ",(0,r.jsx)(i.a,{href:"https://pypi.org/project/certifi/",children:(0,r.jsx)(i.code,{children:"certifi"})})," will fix the following error:"]}),"\n",(0,r.jsx)(i.pre,{children:(0,r.jsx)(i.code,{className:"language-sh",children:"________ running 'python3 src/tools/clang/scripts/update.py' in '/Users/<user>/electron'\nDownloading https://commondatastorage.googleapis.com/chromium-browser-clang/Mac_arm64/clang-llvmorg-15-init-15652-g89a99ec9-1.tgz\n<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>\nRetrying in 5 s ...\nDownloading https://commondatastorage.googleapis.com/chromium-browser-clang/Mac_arm64/clang-llvmorg-15-init-15652-g89a99ec9-1.tgz\n<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>\nRetrying in 10 s ...\nDownloading https://commondatastorage.googleapis.com/chromium-browser-clang/Mac_arm64/clang-llvmorg-15-init-15652-g89a99ec9-1.tgz\n<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>\nRetrying in 20 s ...\n"})}),"\n",(0,r.jsxs)(i.p,{children:["This issue has to do with Python 3.6 using its ",(0,r.jsx)(i.a,{href:"https://github.com/python/cpython/blob/560ea272b01acaa6c531cc7d94331b2ef0854be6/Mac/BuildScript/resources/ReadMe.rtf#L35",children:"own"})," copy of OpenSSL in lieu of the deprecated Apple-supplied OpenSSL libraries. ",(0,r.jsx)(i.code,{children:"certifi"})," adds a curated bundle of default root certificates. This issue is documented in the Electron repo ",(0,r.jsx)(i.a,{href:"https://github.com/electron/build-tools/issues/55",children:"here"}),". Further information about this issue can be found ",(0,r.jsx)(i.a,{href:"https://stackoverflow.com/questions/27835619/urllib-and-ssl-certificate-verify-failed-error",children:"here"})," and ",(0,r.jsx)(i.a,{href:"https://stackoverflow.com/questions/40684543/how-to-make-python-use-ca-certificates-from-mac-os-truststore",children:"here"}),"."]})]})}function u(e={}){let{wrapper:i}={...(0,o.R)(),...e.components};return i?(0,r.jsx)(i,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},28453(e,i,t){t.d(i,{R:()=>s,x:()=>l});var n=t(96540);let r={},o=n.createContext(r);function s(e){let i=n.useContext(o);return n.useMemo(function(){return"function"==typeof e?e(i):{...i,...e}},[i,e])}function l(e){let i;return i=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),n.createElement(o.Provider,{value:i},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.