MacOS permissions when installing from source

Hello,

I have built AW from source in my MacOS 11.4. And when I try to run aw-qt I get over and over again:

Traceback (most recent call last):
  File "/Users/sperez/bin/activitywatch/aw-watcher-window/aw_watcher_window/main.py", line 71, in heartbeat_loop
    current_window = get_current_window(strategy)
  File "/Users/sperez/bin/activitywatch/aw-watcher-window/aw_watcher_window/lib.py", line 55, in get_current_window
    return get_current_window_macos(strategy)
  File "/Users/sperez/bin/activitywatch/aw-watcher-window/aw_watcher_window/lib.py", line 27, in get_current_window_macos
    return macos_jxa.getInfo()
  File "/Users/sperez/bin/activitywatch/aw-watcher-window/aw_watcher_window/macos_jxa.py", line 52, in getInfo
    raise Exception("jxa error: {}".format(err["NSLocalizedDescription"]))
Exception: jxa error: Error: Error: python is not allowed assistive access.

I’m guessing it is related to permissions. Let me know if there is anything I am doing wrong or that I can do to help!
Best,
Sergio

Thanks for bringing this to my attention.

We recently changed the method used to retrieve the active window on macOS: https://github.com/ActivityWatch/aw-watcher-window/pull/52

This error indicates that you need to add the executable (when running from source, that is the python executable) to your accessibility permissions. The same thing was needed before the change, but it used to fail silently (report an empty window title, but still able to report active application), so this is, in a sense, a regression.

Thanks! I will keep this in mind for next time. Although right now I am busy trying out the new version :slight_smile:

How would you do this? I have the same problem with the new version. Which by the way does not start when I click the icon, only when I use the CLI.

How would you do this?

Honestly not sure if you need to do something different the plain aw-qt executable, but here’s a more general guide: https://help.rescuetime.com/article/59-how-do-i-enable-accessibility-permissions-on-mac-osx

Which by the way does not start when I click the icon, only when I use the CLI.

Did you try to do ‘Right click’ -> ‘Open’ on the .app that gives you a different dialog with the option to open the application anyway?

We’re working on getting code signing to work on macOS, which should hopefully get rid of the annoying workarounds needed on macOS…

I’m using MacOS 11.4 (Big Sur) by the way.

I have already done what is in the link and that does fix the problem.

I only get this:


If I use that open button it seems to do something because there is an animation but nothing happens afterwards and the icon at the top of the screen doesn’t appear.

The same problems occurs on MacOS 10.12.6 (Sierra).
I have tried installing the 0.11 and 0.10 version, both without luck.
The problem is identical to what sperezconesa describes.

When using Terminal I get the following issue:
“LSOpenURLsWithRole() failed for the application /Applications/ActivityWatch.app with error -10810.”