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.

Mac OS Catalina - camera permission pop up doesn't appear

See original GitHub issue
  • Version: 22.9.1
  • Electron Version: 10.1.5
  • Electron Type (current, beta, nightly):current
  • Target: DMG

Since upgrading to macOS Catalina 10.15.7 my electron app no longer pops up the OS system dialog that allows a user to grant permission for using the camera/webcam.

The status from systemPreferences.getMediaAccessStatus("camera") initially comes back as 'not-determined'. Then, requesting access to the webcam by calling systemPreferences.askForMediaAccess("camera") just resolves immediately as false, without popping up anything. Subsequent calls to systemPreferences.getMediaAccessStatus("camera") returns"denied". The app no longer appears in the Mac OS security & Privacy preferences pane.

It used to work previously.

Everything else still works, but the pop up not appearing renders the app useless!

Hopefully I’m just missing some sort of plist key or config somewhere, but I have trawled the internet and can’t find a solution yet. There seem to be a lot of reports of other electron powered apps having issues along the same line.

app code:

let status = systemPreferences.getMediaAccessStatus("camera"); // returns 'not-determined'
...
const permission = await systemPreferences.askForMediaAccess("camera"); // resolves to false, without popping up anything 

entitlements.mac.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>com.apple.security.cs.allow-jit</key>
		<true/>
		<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
		<true/>
		<key>com.apple.security.cs.disable-library-validation</key>
		<true/>
		<key>com.apple.security.cs.allow-dyld-environment-variables</key>
		<true/>
		<key>com.apple.security.device.camera</key>
		<true/>
	</dict>
</plist>

build bit from package.json

"build": {
    "productName": "productName",
    "publish": [... ],
    "afterSign": "scripts/notarize.js",
    "appId": "com.electron.productName",
    "buildDependenciesFromSource": true,
    "mac": {
      "category": "public.app-category.productivity",
      "hardenedRuntime": true,
      "gatekeeperAssess": false,
      "entitlements": "build/entitlements.mac.plist",
      "entitlementsInherit": "build/entitlements.mac.plist",
      "extendInfo": {
        "LSMinimumSystemVersion": "10.12.6",
        "NSCameraUsageDescription": "Please give access to your webcam",
        "NSAppTransportSecurity": {
          "NSAllowsArbitraryLoads": true
        }
      }
    },
    "dmg": {
      "sign": false
    },
}

The app successfully builds and gets signed, and installs, and runs.

I think I’ve got all the right stuff in those config files, and because it all used to work on a previous version of MacOS (High Sierra) I’m not sure what to do. Just a bit stuck, so wondering if anyone has any ideas or can point me in a direction to figure out what’s wrong 🙏

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
iamalismithcommented, Jun 25, 2021

Ha ha! Then we have shared in the same world of pain! Hope you haven’t spent as long as I did trying to track down the fix 🤣 😭 .

Hope this sorted it for you 👍

1reaction
stale[bot]commented, Dec 24, 2020

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Control access to the camera on Mac - Apple Support
Control access to the camera on Mac · Choose Apple menu > System Settings, then click Privacy & Security in the sidebar. (You...
Read more >
Apps don't show up in camera and microphone privacy ...
Finder > Go > Computer · Macintosh HD > user > Double finger tap on your account > Get Info · Sharing &...
Read more >
How to allow access to camera on Mac - MacPaw
#1 Use System Preferences · Go to the Apple menu. · Choose System Preferences. · Click Security & Privacy. · Choose Camera from...
Read more >
Enable Camera and Microphone on my Mac (for Chrome)
*If you don't see Camera or Google Chrome option, please update your MacOS to the latest version (Click Apple Icon > About This...
Read more >
How to fix macOS Accessibility permission when an app can't ...
When the macOS session is running and accepts your input, return to the Privacy tab and check any boxes needed to enable software...
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