-
-
Notifications
You must be signed in to change notification settings - Fork 454
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
Error launching Chrome on MacOs : Permission denied #2337
Comments
What does |
It might be because we check for OSX, but the newer mac OS identifies itself as MACOS. I don't have a Mac at hand to test this out, but a guess is to change
to if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("MACOS"))) @borjafdezgauna what does |
@jnyrup, this is what my mac returns: BrowserFetcher.Platform => MacOS Thanks! |
I missed your
Does it return that on both net core 3.1 and net6? As a workaround, try explicitly setting the platform. BrowserFetcherOptions options = new BrowserFetcherOptions() { Path = downloadDir, Platform = Platform.MacOSArm64 }; |
On Net Core 3.1: On Net6: Oh my!! I am quite sure I tested it with Net6 and that it didn't work, but I did it again now, and it launched Chrome properly. I don't know how, but I must have done something wrong before, and it works with Net6. I will edit my post now Any thoughts on how I could fix it for NetCore 3.1? Some of the users cannot update their MacOS and we're basically stuck with NetCore3.1 to support their OS Thank you very much! |
I don't have any good solutions, but maybe something like this hack would be enough for you? Platform? platform = null;
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
platform = Platform.MacOSArm64;
}
BrowserFetcherOptions options = new BrowserFetcherOptions() { Path = downloadDir, Platform = platform }; @kblok Have you considered adding |
@jnyrup, it's on my to-do list. The only tricky part there is the certificates we need to install. |
@jnyrup I have done some tests with your hack and it seems that the problem is not related with the X64/XARM64 issue. Changing the platform manually to ARM64 downloaded the arm64 version correctly, but it wouldn't run from the NetCore3.1 app. I believe this is because NetCore3.1 emulates x64 and cannot execute the arm64 version of Chrome in emulated mode. I managed to make it work after running these two commands from the app (using a Process with FileName="/bin/bash" and Arguments=-c "[COMMAND]"):
I think this should have no side effect in Net6 or older versions of Mac, so I think it's quite safe Thank you so much!! |
Hi there,
I am using PuppeteerSharp 12 on a MacBook Air running MacOs Ventura 13.4
Description
It runs perfectly on Windows, but on Mac, the LaunchAsync() methods throws a Permission denied exception
Complete minimal example reproducing the issue
Expected behavior:
It should launch Chrome
Actual behavior:
It throws an exception: System.ComponentModel.Win32Exception (13) Permission denied (ForkAndExecProcess)
Versions
I am using PuppeteerSharp 12, but I have also tried it with 11.0.4
I am using .Net Core 3.1. Edit: With NET6 it works properly
Additional info
Edit 1:
_If I try to run the downloaded copy of "Google Chrome for Testing.app" from a terminal, then I get the error: "The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10661 "(null)" UserInfo={_LSLine=4106, _LSFunction=LSOpenStuffCallLocal}
Edit 2:
I tried to run directly the executable inside the Contents/MacOS and then it said "The use of Rosetta to run the x64 version of Chromium on Arm is neither tested nor maintained, and unexpected behavior will likely result. Please check that all tools that spawn Chromium are Arm-native". I am running on a MacBook Air. I downloaded the arm version of Google Chrome for Testing and it ran after doing "sudo xattr -cr 'Google Chrome for Testing.app'".
System.Runtime.InteropServices.RuntimeInformation.OSArchitecture returns x64. I think it should be Arm64, should'nt it?
Any help is appreciated
Cheers
The text was updated successfully, but these errors were encountered: