pywalfox: Fails to fetch pywal colors on Mac OS

I set up pywalfox according to the installation guide but Firefox’s theme colors do not change when the “Fetch Pywal colors” button is clicked.

In the browser console I got this: Error: Attempt to postMessage on disconnected port.

Any insight?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 27 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Any errors in the Browser console in Firefox?

stderr output from native app pywalfox: /Users/<username>/Library/Python/2.7/lib/python/site-packages/pywalfox/bin/main.sh: line 3: pywalfox: command not found

Bingo. I had looked before, but must have missed it. I was able to resolve it by opening main.sh and explicitly setting the path to the output of which pywalfox.

/Users/<username>/Library/Python/2.7/bin/pywalfox

For some reason even though when I check any terminal (iTerm2 Terminal.app vscode ) with which pywalfox it appears, main.sh does not seem to know where it’s at (maybe?). Thank you for leading me to that though and thanks for you work on this.

Edit (Guesses):

I think this has something to do with main.sh using the BASH environment. Since, 10.15 macOS has switched from BASH to ZSH. I am able to work around the issue by sourcing my .zshrc first. then running pywal daemon.

#!/usr/bin/env bash

source ~/.zshrc
pywalfox daemon

This also might be why sudo works for some people. Because it would put it in the $PATH everywhere (I think). In macOS however installing with sudo doesn’t help because its still a different shell. My guess is that this would work normally on 10.14.

that worked !!! thank you:)

If you wanted something quick and dirty this would probably sort all the macOS users out.

#!/usr/bin/env bash

# Checks OS Version Number
macOS=$(sw_vers -productVersion)
if [[ ${#macOS} > 0  ]]; then
    PATH="$PATH:/usr/local/bin"
    pywalfox start
fi

python -m pywalfox start || python3 -m pywalfox start || python2.7 -m pywalfox start

The path variable is contextual on macOS apparently. (https://scriptingosx.com/2018/02/setting-the-path-in-scripts/)

Seems weird that Firefox would not find python, but honestly, I should just create a copy of main.sh during installation and set the absolute path dynamically. It feels like 90% of the issues people are having would be fixed if I did this. I am not sure why I have put it off for so long.

Thanks for the update though, I will look into it 👍

That worked, thank you!!

Yes, zsh and the bash shebang is most likely what is causing issues.

I should skip main.sh completely and point to the executable directly in the Firefox manifest. That should eliminate all PATH issues and probably close #31 and #33 as well.