balta2ar / brotab

Control your browser's tabs from the command line
MIT License
394 stars 28 forks source link

Doesn't work on macOS (wrong manifest directory) #43

Open thepaul opened 4 years ago

thepaul commented 4 years ago

Everything seems to install correctly, but the bt command-line tool can't find any clients to talk to (empty output from bt clients and bt list).

After some debugging I found that the tool is installing the native-messaging manifest in the wrong directory. ~/.mozilla/native-messaging-hosts is the directory for Firefox on Linux. For Firefox on Mac, it should be in ~/Library/Application Support/Mozilla/NativeMessagingHosts. Moving the manifest file into the correct directory and reloading the extension makes everything work. Yay!

I don't know the correct directories for native messaging manifests under Chrome or Brave, but it looks like they need similar changes to work on macOS.

felciano commented 3 years ago

I've got this issue as well. Is there a recommended solution for Mac across Firefox, Chrome and Safari?

twisst commented 3 years ago

@thepaul's solution to this problem worked for me as well. I only had to create that directory myself. Restarted Firefox and it worked!

minamotorin commented 3 years ago

I had same issue on macOS with Brave Browse, but I could solve the issue with the comment. It work fine for me after run following commands and reload brotab's background page:

$ bt install 
$ mkdir -p ~/Library/Application\ Support/BraveSoftware/Brave-Browser/NativeMessagingHosts
$ cp -i ~/.config/BraveSoftware/Brave-Browser/NativeMessagingHosts/brotab_mediator.json ~/Library/Application\ Support/BraveSoftware/Brave-Browser/NativeMessagingHosts
mskar commented 3 years ago

I ran the code below but still no luck with either Firefox, Brave, or Chrome, even after restart.

bt install 
mkdir -p ~/Library/Application\ Support/BraveSoftware/Brave-Browser/NativeMessagingHosts
cp -i ~/.config/BraveSoftware/Brave-Browser/NativeMessagingHosts/brotab_mediator.json ~/Library/Application\ Support/BraveSoftware/Brave-Browser/NativeMessagingHosts
mkdir -p ~/Library/Application\ Support/Mozilla/NativeMessagingHosts
cp -i ~/.mozilla/native-messaging-hosts/brotab_mediator.json ~/Library/Application\ Support/Mozilla/NativeMessagingHosts

There is still no output from bt list... Update: Firefox is working...

minamotorin commented 3 years ago

Is your brotab‘s extension page‘s url chrome-extension://mhpeahbikehnfkfnmopaigggliclhmnc/ ? If you installed brotab extension manually, you should add your brotab‘s extension page‘s url to brotab_mediator.json .

jswent commented 2 years ago

If anyone is still having an issue with Brave not working, putting the brotab_mediator.json file in the Chrome NativeMessagingHosts directory (~/Library/Application Support/Google/Chrome/NativeMessagingHosts) solved the issue for me.

EDIT: Fix for Brave on MacOS:

bt install
mkdir -p ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts
cp -i ~/.config/BraveSoftware/Brave-Browser/NativeMessagingHosts/brotab_mediator.json ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts
rickallauigan commented 1 year ago

This works on me:

Note: Replace <HOME_FOLDER> with your home folder

Microsoft Edge:

  1. Run bt install bt install

  2. Create directory for Microsoft Edge/NativeMessagingHosts if not exists

    mkdir -p "/Users/<HOME_FOLDER>/Library/Application Support/Microsoft Edge/NativeMessagingHosts"
  3. Copy brotab_mediator.json file from chromium to Microsoft Edge/NativeMessagingHosts

    cp /Users/<HOME_FOLDER>/.config/chromium/NativeMessagingHosts/brotab_mediator.json "/Users/<HOME_FOLDER>/Library/Application Support/Microsoft Edge/NativeMessagingHosts"
  4. Re-install brotab chrome extension (this also works on Microsoft Edge):

  5. Run bt clients, results should be (if you also have firefox): image

For Mozilla:

Brotab mediator location: ~/.mozilla/native-messaging-hosts/brotab_mediator.json Target directory: /Users/<HOME_FOLDER>/Library/Application Support/Mozilla/NativeMessagingHosts

For Google Chrome:

Brotab mediator location: ~/.config/google-chrome/NativeMessagingHosts/brotab_mediator.json Target directory: /Users/<HOME_FOLDER>/Library/Application Support/Google/Chrome/NativeMessagingHosts

grandkrav commented 8 months ago

I have the same issue on macOS with Firefox and Chrome - bt clients return nothing. I have tried to change the mediator location - but it does not help.

OS: macOS 13.4 Firefox: 121.0.1 Chrome: Version 120.0.6099.199 (Official Build) (arm64)

grandkrav commented 8 months ago

I have the same issue on macOS with Firefox and Chrome - bt clients return nothing. I have tried to change the mediator location - but it does not help.

OS: macOS 13.4 Firefox: 121.0.1 Chrome: Version 120.0.6099.199 (Official Build) (arm64)

Found the root cause: bt_mediator return error:

Traceback (most recent call last):
  File "/opt/homebrew/bin/bt_mediator", line 5, in <module>
    from brotab.mediator.brotab_mediator import main
  File "/opt/homebrew/lib/python3.11/site-packages/brotab/mediator/brotab_mediator.py", line 15, in <module>
    from brotab.mediator.http_server import MediatorHttpServer
  File "/opt/homebrew/lib/python3.11/site-packages/brotab/mediator/http_server.py", line 7, in <module>
    from flask import Flask
  File "/opt/homebrew/lib/python3.11/site-packages/flask/__init__.py", line 7, in <module>
    from .app import Flask as Flask
  File "/opt/homebrew/lib/python3.11/site-packages/flask/app.py", line 28, in <module>
    from . import cli
  File "/opt/homebrew/lib/python3.11/site-packages/flask/cli.py", line 18, in <module>
    from .helpers import get_debug_flag
  File "/opt/homebrew/lib/python3.11/site-packages/flask/helpers.py", line 16, in <module>
    from werkzeug.urls import url_quote
ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/opt/homebrew/lib/python3.11/site-packages/werkzeug/urls.py)

It looks like the Flask version is not compatible with the Werkzeug.

pip uninstall werkzeug && pip install werkzeug==2