yabai
yabai copied to clipboard
Yabai's scripting addition didn't automatically load after upgrade to Big Sur (11.2.1)
Hello,
I just upgraded to Big Sur (11.2.1) and hit one minor issue in case others hit it...
I have followed the instructions to open the necessary holes in SIP. And I have re-installed the scripting addition, etc., without trouble. I have gotten the typical accessibility enabling notification, but not the one regarding Dock.app that I got with Catalina.
Installing the scripting addition worked without error:
$ sudo yabai --install-sa
However, even after this, and reloading yabai (and rebooting, etc), I was unable to do operations requiring the scripting addition:
$ yabai -m space --focus prev
cannot focus space due to an error with the scripting-addition.
I fixed it by manually loading the scripting addition:
$ sudo yabai --load-sa
Just to be clear, now everything works, so I'm not really blocked on anything.
I don't recall having to separately load the scripting addition in the past. Unsure if this occured because I had yabai installed when upgrading? Or some other reason?
Filing the issue in part to leave findable clues if anyone searches for these messages having hit the same issue. But also to see if the failure to automatically load is due to a bug. (Unsure how to even debug it now though...)
The injection method had to change necessarily for Big Sur. See here for a guide on how to set up automatic loading of the scripting addition:
https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)#macos-big-sur---automatically-load-scripting-addition-on-startup
It isn't a beauty, but it's the only way without requiring a password that I know of.
Ah, I hadn't found that page when doing my upgrade. I instead mostly read the standing documentation. =/
Anyways, this all makes sense (and matches that I had to use sudo
to load the scripting addition) so this seems clearly WAI. Unsure what (if any) documentation changes make sense.
Is there a way to print this information from Homebrew? It might already be printed and I missed it while updating everything, which is entirely on me.
Is there a way to print this information from Homebrew? It might already be printed and I missed it while updating everything, which is entirely on me.
Feel free to expand the caveats section in the yabai Homebrew formula or even just suggest what information should be listed in there. Feedback on docs is always appreciated.
Perhaps the brew service
(the plist file specified in the formula linked above, I assume) could --load-sa
on (re)start?
Or perhaps --install-sa
should also load?
I suggest these because the two things I tried (before coming here) were sudo yabai --install-sa
, brew services restart yabai
, (and shutdown -r now
) I don't think I knew about the existence of or had previously needed --load-sa
, those two were enough (even after previous system updates) until I restarted for an update just now.
I'm pretty sure this is explained here?
Can we get a comprehensive guide to install Yabai on Big Sur (I'm also on 11.2.1, but I'm sure SIP would been a problem to get around before)?
I followed the instructions on in the install page, but I probably don't have the scripting additions installed.
sudo yabai --install-sa
yabai: System Integrity Protection: Filesystem Protections must be disabled!
I made sure I have a ~/.yabairc
containing
sudo yabai --load-sa
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
Can't load what I never installed due to SIP. The guide doesn't talk about getting around SIP however.
Please do this (https://github.com/koekeishiya/yabai/wiki/Disabling-System-Integrity-Protection) first. Also, the entire wiki page (https://github.com/koekeishiya/yabai/wiki) is really helpful. Don't miss the table of contents on the right-hand side of the wiki page.
Thank you. Does SIP need to stay disabled permanently on Big Sur 11.2.1 or can I reenable it after installation of the -sa
?
@BlkPingu Yes. SIP should be partially disabled (debug and fs must be disabled) all the time as long as you want to use the advanced features of yabai. You can get the full list of the advanced features from here. The advanced features require the installation of scripting addition which requires a disabled SIP. That is, if you don't want to use the advanced features, you don't need to install the scripting addition and you can keep SIP being fully enabled.
debug and fs must be disabled
From Disabling System Integrity Protection:
How do I disable System Integrity Protection? ...
# If you're on macOS 11.0.1 ... csrutil disable --with kext --with dtrace --with nvram --with basesystem
@yanzhang0219 is this command still up to date and sufficient? I'd like to disable as little to meet the "debug and fs disabled" criteria
Yes. I think
# If you're on macOS 11.0.1
# Requires Filesystem Protections and Debugging Restrictions to be disabled (workaround because --without debug does not work)
# (printed warning can be safely ignored)
csrutil disable --with kext --with dtrace --with nvram --with basesystem
should be work on the latest officially released macOS. You could give it a shot.
@koekeishiya Could you please double check and update the wiki page? Thank you.
@BlkPingu and @yanzhang0219 - Maybe take this to a separate issue or discussion? I'd like to keep this focused on improving the discoverability of the change in workflow here.
Okay. I am so sorry about making a mess. 👊
Is there a way to print this information from Homebrew? It might already be printed and I missed it while updating everything, which is entirely on me.
Feel free to expand the caveats section in the yabai Homebrew formula or even just suggest what information should be listed in there. Feedback on docs is always appreciated.
Thinking about this more, I'd like to suggest what I think would really help folks discover this:
When Yabai starts (including restarts), check if the scripting addition has been installed but not loaded (even if this has to be done manually by leaving a breadcrumb behind when --install-sa
and --load-sa
have been run successfully). Then, give a notification about unloaded SA and the link you posted to help folks figure out how to make automatic loading work?
That plus some helpful guidance in the brew install
flow I think would nicely cover the likely different ways folks would hit this and not understand why things don't work as expected. I can even suggest the homebrew text potentially (want to reinstall to look at the flow), but I have no idea where to start on adding a notification about the situation.
Perhaps the brew service (the plist file specified in the formula linked above, I assume) could --load-sa on (re)start?
This does not work because the --load-sa command still requires elevated privileges.
Or perhaps --install-sa should also load?
This only "solves" the problem until the user relogs, reboots, or Dock.app is restarted.
I suggest these because the two things I tried (before coming here) were sudo yabai --install-sa, brew services restart yabai, (and shutdown -r now) I don't think I knew about the existence of or had previously needed --load-sa, those two were enough (even after previous system updates) until I restarted for an update just now.
The reason for that is that in prior versions of macOS, yabai is capable of loading the scripting-addition upon launch, because it does not need root privileges to do so.
When Yabai starts (including restarts), check if the scripting addition has been installed but not loaded (even if this has to be done manually by leaving a breadcrumb behind when --install-sa and --load-sa have been run successfully). Then, give a notification about unloaded SA and the link you posted to help folks figure out how to make automatic loading work?
So the challenge in doing this is that the config file is launched asynchronously at the end of the yabai startup: https://github.com/koekeishiya/yabai/blob/master/src/yabai.c#L316 This makes it hard to detect if someone has already adjusted their config or not, as the check would have to happen x amount of time afterwards. Depending on how large or complex the users configuration is, and when the call to load-sa is performed, that time may vary heavily from the initial launch. I will try to think some more about this problem, but I don't think it is as easy to solve as it may seem at first.
This only "solves" the problem until the user relogs, reboots, or Dock.app is restarted.
Sure, I just meant for easier UX since that's what I was aware of to try without reaching for issues/wiki here. Is there a reason one would ever --install-sa
without also wanting to --load-sa
?
The rest all makes sense and the above linked wiki is a much better fix, I only meant to suggest what might be slightly less jarring until someone found them.
Cheers.
Just a note to connect this with #1287