koekeishiya / yabai

A tiling window manager for macOS based on binary space partitioning
MIT License
23.16k stars 641 forks source link

yabai can't acquire accessibility permissions and won't start (macos Sonoma) #2105

Closed paraversal closed 6 months ago

paraversal commented 7 months ago

I've been trying to get a basic yabai v6.0.12 config working for a couple hours, but for some reason it just doesn't want to work.

I have tried all kinds of combinations of yabai--[stop|start]-service, multiple complete clean reinstalls via brew, deleting the yabai tmp directory and force-closing yabai (like was recommended in #2049), removing and re-approving accessibility permissions (which resulted in either no response, or my machine completely locking up to the point where I had to reset it). I feel like I am at my wit's end.

The err.log only says "yabai: could not access accessibility features! abort..", and the out.log is empty.

yabai -V works though, and outputs lots of event data.

I have tried to minimise my configuration as much as possible (turned off BTT, Karabiner Elements, Bartender) in case they were interfering with yabai somehow, but to no avail.

Thanks in advance for any help

boranseckin commented 6 months ago

I am seeing the same issue on v6.0.15 running Sonoma 14.3.1. yabai: could not access accessibility features! abort..

boranseckin commented 6 months ago

It looks like after updating yabai, it showed the pop-up for the accessibility request but instead of using the main desktop, it showed it on top of a fullscreen app on a different desktop (Spotify in this case). After hunting down the pop-up and allowing yabai for accessibility features, it works fine now. This seems like a MacOS issue since the pop-up does not move to the active desktop and gets lost.

paraversal commented 6 months ago

It looks like after updating yabai, it showed the pop-up for the accessibility request but instead of using the main desktop, it showed it on top of a fullscreen app on a different desktop.

I think that's a different issue from what I'm experiencing. The accessibility prompt is showing every time I start yabai (even with accessibility access enabled)

crisidev commented 6 months ago

I am experiencing the same as @paraversal when installing with --HEAD. It does not happen with the latest release.

I don't have scripting addition loaded, I am not sure if it matters.

koekeishiya commented 6 months ago

That sounds like the codesigning issue described in the wiki https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(from-HEAD) ?

This is just how macOS works. To actually use this permission the binary must be codesigned. When installing the latest release, it installs a pre-built binary that I have already codesigned. I guess maybe an ad-hoc signature is good enough.

Try to apply this patch to your yabai brew formula:

diff --git a/yabai.rb b/yabai.rb
index 0af73c2..79def28 100644
--- a/yabai.rb
+++ b/yabai.rb
@@ -12,6 +12,7 @@ class Yabai < Formula

     if build.head?
       system "make", "-j1", "install"
+      system "codesign", "-fs", "-", "#{buildpath}/bin/yabai"
     end

     bin.install "#{buildpath}/bin/yabai"

or this one

diff --git a/yabai.rb b/yabai.rb
index 0af73c2..a664ac1 100644
--- a/yabai.rb
+++ b/yabai.rb
@@ -18,6 +18,10 @@ class Yabai < Formula
     (pkgshare/"examples").install "#{buildpath}/examples/yabairc"
     (pkgshare/"examples").install "#{buildpath}/examples/skhdrc"
     man1.install "#{buildpath}/doc/yabai.1"
+
+    if build.head?
+      system "codesign", "-fs", "-", "#{bin}/yabai"
+    end
   end

   def caveats; <<~EOS
crisidev commented 6 months ago

I haven't tested this yet, but fyabai, @FelixKratz fork works fine and I see it's doing exactly this in its formula:

https://github.com/FelixKratz/homebrew-formulae/blob/master/fyabai.rb#L25

koekeishiya commented 6 months ago

Aight. I'll add it to the formula, but I would personally still do it as described in the wiki.