title: "GPU process isn't usable. Goodbye."
body: <p>I'm experimenting with building a Windows and Mac OS app using Electron and have hit a snag.</p>
  <p>In short, if I try to run the application directly with Electron on Mac OS Big Sur (as opposed to building a Mac app and then running that) I get the following error returned:</p>
  <pre><code>[35941:0821/171720.038162:FATAL:gpu_data_manager_impl_private.cc(415)] GPU process isn't usable. Goodbye.
  </code></pre>
  <p>I am running directly with Electron using the following in my <code>package.json</code>:</p>
  <pre><code>&quot;scripts&quot;: {
    ...
    &quot;test&quot;: &quot;electron main.js&quot;,
    ...
  }
  </code></pre>
  <p>So far the only Mac OS environment I have access to is Big Sur so haven't tried this on earlier versions of Mac OS but from Googling it seems this error may be related to Big Sur's tightened security/sandbox constraints -- but I am guessing about that.</p>
  <p>In any case, after some Googling several suggestions indicated trying to run without the app sandbox, i.e. adding this to <code>main.js</code>:</p>
  <pre><code>app.commandLine.appendSwitch('no-sandbox');
  </code></pre>
  <p>That's all well and good and works.</p>
  <p>However, if I ever want to build and distribute a signed Mac app targeting the Mac App store or a just a signed, sandboxed DMG or PKG installer, then this won't be suitable.</p>
  <p>If I remove the above <code>no-sandbox</code> command from <code>main.js</code> and specify the app sandbox in my entitlements <code>plist</code> as shown below the resulting signed app will not run:</p>
  <pre><code>&lt;key&gt;com.apple.security.app-sandbox&lt;/key&gt;
  &lt;true/&gt;
  </code></pre>
  <p>The app tries to open and just closes. I can try running at the command line with <code>open &lt;appname&gt;.app</code> but this throws the following error in the console:</p>
  <pre><code>The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10826 &quot;kLSNoLaunchPermissionErr: User doesn't have permission to launch the app (managed networks)&quot; UserInfo={_LSFunction=_LSLaunchWithRunningboard, _LSLine=2561, NSUnderlyingError=0x7fd3c9c13db0 {Error Domain=RBSRequestErrorDomain Code=5 &quot;Launch failed.&quot; UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x7fd3c9c158e0 {Error Domain=NSPOSIXErrorDomain Code=153 &quot;Unknown error: 153&quot; UserInfo={NSLocalizedDescription=Launchd job spawn failed with error: 153}}}}}
  </code></pre>
  <p>If I build a signed app with <code>no-sandbox</code> enabled, the app will run just fine on Big Sur using <code>open &lt;appname&gt;.app</code>.</p>
  <p>I have tried my best through Google, Stack Overflow, etc to diagnose this but am not getting anywhere. Here's to hoping the Stack Overflow community can provide me the critical clue to solving this.</p>
  <p>For further context, I created a new, empty Electron application and followed the <a href="https://www.electronjs.org/docs/latest/tutorial/quick-start" rel="noreferrer">Electron Quick Start Guide</a> to the section where it describes creating an empty <code>main.js</code> which technically should allow the Electron app to start -- but it won't. The same error describe above re the GPU gets thrown even without instantiating a <code>BrowserWindow</code> or writing any custom code of my own.</p>
  <p>NEW UPDATE: I set these environment variables to true and then tried running the app with <code>npm start</code>:</p>
  <ul>
  <li><code>ELECTRON_ENABLE_LOGGING</code></li>
  <li><code>ELECTRON_DEBUG_NOTIFICATIONS</code></li>
  <li><code>ELECTRON_ENABLE_STACK_DUMPING</code></li>
  </ul>
  <p>The result is more detailed error output:</p>
  <pre><code>[48836:0823/165857.676747:ERROR:icu_util.cc(179)] icudtl.dat not found in bundle
  [48836:0823/165857.676838:ERROR:icu_util.cc(243)] Invalid file descriptor to ICU data received.
  [48778:0823/165857.677376:ERROR:gpu_process_host.cc(1003)] GPU process exited unexpectedly: exit_code=5
  [48778:0823/165857.677430:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 1 time(s)
  [48850:0823/165857.827224:ERROR:icu_util.cc(179)] icudtl.dat not found in bundle
  [48848:0823/165857.827255:ERROR:icu_util.cc(179)] icudtl.dat not found in bundle
  [48850:0823/165857.827341:ERROR:icu_util.cc(243)] Invalid file descriptor to ICU data received.
  [48848:0823/165857.827358:ERROR:icu_util.cc(243)] Invalid file descriptor to ICU data received.
  [48778:0823/165857.827836:ERROR:gpu_process_host.cc(1003)] GPU process exited unexpectedly: exit_code=5
  [48778:0823/165857.827875:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 2 time(s)
  ... repeats until the GPU processes crashes 9 times ...
  [48778:0823/165903.080134:FATAL:gpu_data_manager_impl_private.cc(415)] GPU process isn't usable. Goodbye.
  </code></pre>
  <p>Haven't had time to do the research as to what ICU refers to but thought I would update with this info.</p>
  <p>ANOTHER UPDATE: all this has been done on Mac OS Big Sur which is my main development machine. Trying this on a Windows 10 machine, using the same Electron code, dependencies, etc and things work fine. So the problem is either related to Mac OS Big Sur or a specific local issue on my development machine which I cannot identify. Any suggestions on how to diagnose this will be much appreciated.</p>
  <p>ONE MORE UPDATE: Based on a guess, I created a new user on my mac, took the code in there and it ran perfectly. So -- this probably means that I need to find something installed in my profile or some corruption in my own profile/settings that is breaking things. As always, any suggestions appreciated it.</p>