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

MAC os support #59

Closed
jswhisperer opened this issue Mar 20, 2023 · 20 comments · Fixed by #66
Closed

MAC os support #59

jswhisperer opened this issue Mar 20, 2023 · 20 comments · Fixed by #66

Comments

@jswhisperer
Copy link

Anything to try with clang or gcc, otherwise a ticket to watch support.

@hassandraga
Copy link
Member

In WebUI 1.x (Written in C++), someone was maintaining the Mac support. Currently, WebUI 2.x is wholly rewritten in C, and no one has yet created a PR for Mac.

If no one creates a PR for Mac in the next week or two, then I will work on it. It's just a one-weekend day job. Please keep this open. Thank you for reporting.

@cowboyd
Copy link
Contributor

cowboyd commented Mar 28, 2023

@hassandraga I'd give it a shot, but it doesn't look like the build process is documented anywhere. Any tips on where to get started?

@AlbertShown
Copy link
Contributor

Hi @cowboyd, The build process is very simple, take a look on the Linux build as it should be similar to macOS.

This is the how Firefox run in macOS in the code, you can search 'macOS' keyword in the code to see the other commands that still need to be implemented. I guess no C code is needed, but we need someone that have a macOS, and he know how to run web browsers from command line.

In the other hand, you can simply test and share with us the commands result before & after installing the browsers, me or someone will implement it.

Google Chrome
Check if browser exist by the returning code: open -R -a "Google Chrome"
Browser path: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome

Firefox
Check if browser exist by the returning code: open -R -a "firefox"
Browser path: /Applications/Firefox\ Firefox.app/Contents/MacOS/Firefox\ firefox

Epic Browser
Check if browser exist by the returning code: open -R -a "Epic"
Browser path: /Applications/Epic\ Epic.app/Contents/MacOS/Epic\ Epic

Vivaldi Browser
Check if browser exist by the returning code: open -R -a "Vivaldi"
Browser path: /Applications/Vivaldi\ Vivaldi.app/Contents/MacOS/Vivaldi\ Vivaldi

Brave Browser
Check if browser exist by the returning code: open -R -a "Brave"
Browser path: /Applications/Brave\ Brave.app/Contents/MacOS/Brave\ Brave

Yandex Browser
Check if browser exist by the returning code: open -R -a "Yandex"
Browser path: /Applications/Yandex\ Yandex.app/Contents/MacOS/Yandex\ yandex-browser

Chromium Browser
Check if browser exist by the returning code: open -R -a "Chromium"
Browser path: /Applications/Chromium\ Chromium.app/Contents/MacOS/Chromium\ chromium

Someone last year tested and implemented the Google Chrome commands on macOS, but the other browser's command is just our imagination! never tested before.

@cowboyd
Copy link
Contributor

cowboyd commented Mar 28, 2023

I added a build for MacOS. For some context, I'm trying to get this running with Deno and MacOS. It does appear to work, in that the Chrome window appears. However, the hello_world.ts return immediately, and does not wait for webui.wait();

@jswhisperer
Copy link
Author

open -a "Google Chrome" worked but not with -R flag

@AlbertShown
Copy link
Contributor

Thank you for the macOS support.

About the issue, I re-test it in Windows using Chrome, and it seems to be working. Can you please follow those steps to share the log:

  1. Re-build the lib using make debug command
  2. Copy webui-2-x64.dyn in examples/TypeScript/Deno/module
  3. Run deno run --allow-all --unstable hello_world.ts
  4. Share the logs here

@AlbertShown
Copy link
Contributor

open -a "Google Chrome" worked but not with -R flag

Indeed, open -R -a "Google Chrome" is the way how WebUI checks quickly if Google Chrome is installed, it's supposed not to run it.

To run it, WebUI will use something like that /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir="/tmp/WebUIChromeProfile" --no-first-run --disable-gpu --disable-software-rasterizer --no-proxy-server --safe-mode --disable-extensions --disable-background-mode --disable-plugins --disable-plugins-discovery --disable-translate --bwsi --disable-sync --incognito --app=http://localhost:123456.

@AlbertShown
Copy link
Contributor

@cowboyd You can re-test it using the last commit. If you still have an issue with webui.wait();, please feel free to open a new one.

@AlbertShown
Copy link
Contributor

@gregpalaci You can re-test it using the last commit. If Chrome doesn't run on macOS, please feel free to open a new issue.

@jswhisperer
Copy link
Author

jswhisperer commented Apr 1, 2023

file:///Users/carflow/Sites/newwebui/webui/examples/TypeScript/Deno/module/webui.ts:5340: Uncaught TypeError: Deno.UnsafePointer.create is not a function

I guess that is built into the binary via include/webui.h ?

But it does open in chrome, opens in chrome no matter what actually

@AlbertShown
Copy link
Contributor

@gregpalaci, Are you trying to run a TypeScript example? if yes, please make sure you are using the latest Deno, as they just recently did major changes on pointers support using v8. I test it using Deno v1.31.3.

I guess that is built into the binary via include/webui.h ?

Yes, if your UI calls .js or .ts files, WebUI tries to interpret those files using Deno or Nodejs if available. But you can fully control this behavior using APIs.

webui_script_runtime(my_window, webui.runtime.deno); // Deno
webui_script_runtime(my_window, webui.runtime.nodejs); // Nodejs
webui_script_runtime(my_window, webui.runtime.none); // Disable this feature

@AlbertShown
Copy link
Contributor

@gregpalaci I just discovered that we forgot to update the Deno examples to WebUI v2.1.1. I will update it soon. Thank you for pointing this out.

@jswhisperer
Copy link
Author

deno 1.29.2 (release, aarch64-apple-darwin)
v8 10.9.194.5
typescript 4.9.4
just FYI

@hassandraga
Copy link
Member

Starting from Deno 1.31 (Replace pointer integers with v8::External objects), which is used by webui.ts. I think you should upgrade your Deno to the latest.

@jswhisperer
Copy link
Author

Brave Browser
Check if browser exist by the returning code: open -R -a "Brave"
Browser path: /Applications/Brave\ Brave.app/Contents/MacOS/Brave\ Brave

open -R -a "Brave Browser"

Brave doesn't work

@AlbertShown
Copy link
Contributor

open -R -a "Brave Browser" won't run the browser, but it returns the exit code, 0 mean it exists, otherwise, it means it does not exist.

The latest commit support Chrome in macOS. The support for Brave in macOS is also included but has yet to be tested. Can you please try open -W "/Applications/Brave.app"? Or, simply clone the latest commit and run the examples.

@jswhisperer
Copy link
Author

open -W "/Applications/Brave.app"
The file /Applications/Brave.app does not exist.

open -W "/Applications/Brave Browser.app" opens

@jswhisperer
Copy link
Author

Sorry I meant this error from before I understand the -R flag now
$: open -R -a "Brave" Unable to find application named 'Brave'

@AlbertShown
Copy link
Contributor

Great! Then we should fix this in the code.
Would you like please change this line online (no need for git clone & push)?

@AlbertShown
Copy link
Contributor

Please, let's continue at #75.

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

Successfully merging a pull request may close this issue.

4 participants