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 M1 CPU Screen Recording Permission Issue [Fix] #1231

Open
codercodingthecode opened this issue Sep 20, 2024 · 6 comments
Open

MacOS M1 CPU Screen Recording Permission Issue [Fix] #1231

codercodingthecode opened this issue Sep 20, 2024 · 6 comments

Comments

@codercodingthecode
Copy link

codercodingthecode commented Sep 20, 2024

MacOS M1 CPU Screen Recording Permission Issue [Fix]

Issue

Many users have reported screen permission issues on M1 Macs, with some resorting to installing Rosetta despite using an M1-specific build. The root cause is that the node package used to request permissions is based on Intel architecture, thus requiring Rosetta on M1 chips.

Solution

I've made the following modifications to resolve this issue:

  1. Upgraded Node.js version to 16 to use M1 APIs natively.
  2. Removed the Intel-dependent library mac-screen-capture-permissions.
  3. Utilized Electron's native API support for permission requests.

These changes allow the app to request and use screen recording permissions on M1 Macs without the Rosetta workaround.

Implementation Details

  1. Updated package.json to use Node.js 16.
  2. Removed mac-screen-capture-permissions from dependencies.
  3. Modified the screen capture permission code to use Electron's systemPreferences API:

Application

I've built the release version of the app with these changes, and it's available in the release section of my forked repository.

  1. Download the zipped app from release.
  2. Unzip and move it to the Applications folder.
  3. Grant the necessary permissions.
  4. Launch the app and verify that screen recording works without Rosetta.

This solution should allow Kap to function natively on M1 Macs without any Intel-based dependencies for screen recording permissions.

https://github.com/codercodingthecode/Kap/releases/download/m1-permission/Kap.zip

If there is an interest from the maintainers, I can open a pr with these changes to the main project.

image

Kapture 2024-09-20 at 13 39 14

@boodaah3d
Copy link

As of today, I get this error message on the new Mac Mini M4 base model.

Unhandled Promise Rejection
Error: Command failed: /Applications/Kap.app/Contents/Resources/app.asar.unpacked/node_modules/mac-screen-capture-permissions/screen-capture-permissions
spawnSync /Applications/Kap.app/Contents/Resources/app.asar.unpacked/node_modules/mac-screen-capture-permissions/screen-capture-permissions Unknown system error -86
    at Function.module.exports.sync (/Applications/Kap.app/Contents/Resources/app.asar/node_modules/mac-screen-capture-permissions/node_modules/execa/index.js:168:25)
    at exports.hasScreenCapturePermission (/Applications/Kap.app/Contents/Resources/app.asar/node_modules/mac-screen-capture-permissions/index.js:27:25)
    at ensureScreenCapturePermissions (/Applications/Kap.app/Contents/Resources/app.asar/dist-js/common/system-permissions.js:64:23)
    at /Applications/Kap.app/Contents/Resources/app.asar/dist-js/index.js:104:65

So I went to codercodingthecode's fork and download their release but I get this error dialog.

Screenshot 2024-11-29 at 6 44 26 PM

@codercodingthecode
Copy link
Author

I will take a look at this.
@boodaah3d Please let me know if you deleted the previously installed app before trying the new one.
I ran into a similar issue because I had forgotten to remove the old broken one from the installation folder.

@boodaah3d
Copy link

boodaah3d commented Dec 2, 2024

This was a new Mac mini and I installed the latest version here and got the error message. And then I read the thread here and tried the version from the fork. Those were the only versions installed on the system ever.

When I downloaded the fork, I just replaced the other version in the application folder.

@codercodingthecode
Copy link
Author

@boodaah3d Replacing won't work, you need to remove the old file manually and then re-do the installation with the fork.
I believe there is a cache in the system, just replacing the current app with another[same] app with slightly different content is causing the issue.

@codercodingthecode
Copy link
Author

follow these steps:
download the file, i have updated it.
then unzip and right click to bring up the floating menu and select open
image

then you will get this
image

then click ok and repeat the step above and will get a slightly different option:
image

select open and you will get this:
image

Before selecting move to application folder, make sure you have removed/deleted the older version from that folder and no other copy is running.
after that it should open and ask for the OS permissions, etc.

@boodaah3d
Copy link

I followed the steps and got this ..
Unhandled Promise Rejection
Error: Invalid media type
at ensureScreenCapturePermissions (/Applications/Kap.app/Contents/Resources/app.asar/dist-js/common/system-permissions.js:67:34)
at /Applications/Kap.app/Contents/Resources/app.asar/dist-js/index.js:104:65

But the app seemed to be running so I attempted to make a recording and got this ..

Recording error
Error: Command failed with exit code 1: /Applications/Kap.app/Contents/Resources/app.asar.unpacked/node_modules/aperture/aperture record --process-id fhr3b1pu8y5 {"destination":"file:///private/var/folders/x2/wyvjk99d2pdcyrx7sm6cm0d80000gn/T/986578f9df237651c1facf2a2b5fa432.mp4","framesPerSecond":30,"showCursor":true,"highlightClicks":false,"screenId":2,"cropRect":[[1720,204],[688,516]],"videoCodec":"avc1"}
Error Domain=AVFoundationErrorDomain Code=-11805 "Cannot Record" UserInfo={NSLocalizedRecoverySuggestion=Try recording again., NSLocalizedDescription=Cannot Record, AVErrorRecordingSuccessfullyFinishedKey=false}
at makeError (/Applications/Kap.app/Contents/Resources/app.asar/node_modules/aperture/node_modules/execa/lib/error.js:60:11)
at handlePromise (/Applications/Kap.app/Contents/Resources/app.asar/node_modules/aperture/node_modules/execa/index.js:118:26)

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

2 participants