Bigman
Bigman

Reputation: 1473

Chrome Native Messaging API on Mac

I am walking through the Chrome Native Messaging API guide,

https://developer.chrome.com/extensions/nativeMessaging

A sample host's manifest looks like this,

{
  "name": "com.my_company.my_application",
  "description": "My Application",
  "path": "C:\\Program Files\\My Application\\chrome_native_messaging_host.exe",
  "type": "stdio",
  "allowed_origins": [
    "chrome-extension://knldjmfmopnpolahpmmgbagdohdnhkik/"
  ]
}

where "path" refers to the app Chrome extension will communicate with. On Windows, either a python script or an exe file will work and will be executed. On Mac OS, I can only get a shell script or a python script to work. I cannot get an .app to be executed.

What I cannot get working is,

"path": "/Applications/Skype.app"

When I do "chrome.runtime.connectNative(hostName)" in the extension, the error info is "Native host has exited." Thanks for help!

Upvotes: 3

Views: 2131

Answers (1)

user4934183
user4934183

Reputation:

On Windows, either a python script or an exe file will work and will be executed. On Mac OS, I can only get a shell script or a python script to work. I cannot get an .app to be executed.

The .app is a directory, not a file. Using your example, the actual executable for Skype is probably at /Applications/Skype.app/Contents/MacOS/Skype.

Right-click a .app in Finder & select "Show Package Contents" to see inside.

Upvotes: 5

Related Questions