Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripting-addition must be updated for macOS Sonoma 14.2 #2007

Closed
koekeishiya opened this issue Dec 6, 2023 · 41 comments
Closed

scripting-addition must be updated for macOS Sonoma 14.2 #2007

koekeishiya opened this issue Dec 6, 2023 · 41 comments

Comments

@koekeishiya
Copy link
Owner

title.

@roelvangils
Copy link

I am now using macOS 14.2 (23C64). I have updated the scripting addition and the sudoers.d/yabai file. The command yabai -m query --windows is functioning properly, but I am unable to switch spaces. Nothing happens. I have not encountered any error messages, including in the yabai_username.err.log file.

Should I temporarily revert to the default macOS method of switching spaces with animation, or is there something I am overlooking?

@airstrike
Copy link

airstrike commented Dec 10, 2023

I am now using macOS 14.2 (23C64). I have updated the scripting addition and the sudoers.d/yabai file. The command yabai -m query --windows is functioning properly, but I am unable to switch spaces. Nothing happens. I have not encountered any error messages, including in the yabai_username.err.log file.

Should I temporarily revert to the default macOS method of switching spaces with animation, or is there something I am overlooking?

how did you update the scripting addition? I'm on MacOS 14.1.2 (23B92) and I'm getting

image

when I run

yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
sudo yabai --load-sa

FYI normally I switch spaces with yabai -m space --focus next but that isn't working anymore because yabai isn't loading

@podocarp
Copy link

Same issue here. Things like toggling float on windows work, moving windows to spaces work, but switching to spaces (yabai -m space --focus next etc.) don't work for me.

@Khodaparastan
Copy link

same here

@SzymonMielecki
Copy link

same here but the issue seems similar to #1880

@alwyn
Copy link

alwyn commented Dec 13, 2023

@koekeishiya when you say "Scripting addition must be updated" I am assuming it is a todo for you and not for the users?

@gldtn
Copy link

gldtn commented Dec 13, 2023

@koekeishiya when you say "Scripting addition must be updated" I am assuming it is a todo for you and not for the users?

Yes, he mentioned somewhere that he will do that once it out of beta, I believe it's in RC(release candidate).

@cronJohn
Copy link

I encountered the same issue and have a workaround using MacOS's built-in shortcut for switching spaces/desktops.

  1. Navigate to System Preferences > Keyboard > Keyboard Shortcuts.
  2. Select Mission Control from the left sidebar.
  3. Look for the option Switch to Desktop ... under the Mission Control dropdown.

I was concerned there would be a delay when switching spaces, which is why I used yabai, but that isn't the case. I should note that you will need to delete/comment out the yabai -m space --focus lines in your skhd config if that shortcut is the same as the one in the settings.

@kalebris
Copy link

yeah, that's the workaround I'm using but the workspace switches are slow, there is a significant delay compared to yabai workspace focus change. I'm personally using sketchybar on top, and that gets redrawn every time I do a switch.

@marsjane
Copy link

Same here, it is out of beta now, and after update, can not focus spaces, neither by click the sketchybar

@cronJohn
Copy link

@kalebris That could be because you have a shortcut set for moving left/right a space instead of switching to a specific desktop. There is a delay for me when moving left/right but not when switching to a specific desktop. If that doesn't work, it could be something with sketchybar.

@PrayagS
Copy link

PrayagS commented Dec 15, 2023

macOS 14.2 23C64 is public now, no longer beta. Hope the fix is incoming soon 🤞🏼

@nibocn
Copy link

nibocn commented Dec 15, 2023

I encountered the same issue and have a workaround using MacOS's built-in shortcut for switching spaces/desktops.

  1. Navigate to System Preferences > Keyboard > Keyboard Shortcuts.
  2. Select Mission Control from the left sidebar.
  3. Look for the option Switch to Desktop ... under the Mission Control dropdown.

I was concerned there would be a delay when switching spaces, which is why I used yabai, but that isn't the case. I should note that you will need to delete/comment out the yabai -m space --focus lines in your skhd config if that shortcut is the same as the one in the settings.

After I upgraded to macOS 14.2 (23C64), the yabai -m space --focus related commands could not be used normally. Even if I uninstalled yabai and reinstalled scripting-addition, it still did not work. After reading this method of reply by @cronJohn, I temporarily used this alternative method to achieve a similar effect.

First configure the Mission Control shortcut keys:
image

Comment out the related shortcut key configuration for switching desktops in skhdrc:

image

Then I also found that moving the application window to the specified desktop and then switching to the corresponding desktop would also cause problems. I also made corresponding adjustments to the configuration in skhdrc:

image

@steynh
Copy link

steynh commented Dec 15, 2023

Oh nooo, I updated blindly, not realizing that this is a very new update and that yabai doesn't have the updated scripting addition yet. Thanks in advance for updating the scripting addition @koekeishiya, really appreciate your work! I can't work without yabai anymore xD

@TuralAsgar
Copy link

It doesn't work for me as well.
Script addition doesn't work.

I got so used to yabai, that without it I can't work.
Yabai is the reason why I am not complaining about macOS.

@24unix
Copy link

24unix commented Dec 16, 2023

It doesn't work for me as well. Script addition doesn't work.

I got so used to yabai, that without it I can't work. Yabai is the reason why I am not complaining about macOS.

What is so important about Sonoma that you cannot wait a few days?
I'm still on Ventura, and will stay there until GPG Mail is fixed. Then I'll update, and be assured that Yabai is tested on Sonoma.

@roelvangils
Copy link

What is so important about Sonoma that you cannot wait a few days? I'm still on Ventura, and will stay there until GPG Mail is fixed. Then I'll update, and be assured that Yabai is tested on Sonoma.

Sonoma is an exciting macOS update. Yabai worked well with the initial release and also with 14.1. I agree that, as Yabai "power users"", we should consider waiting for a week or two before upgrading to a point release. This will give the developer time to test and ensure Yabai works properly. It's always a cat and mouse game, unfortunately...

@rockofox
Copy link

The fork by @FelixKratz has been updated to 14.2 (FelixKratz@df5b037)

@schronck
Copy link

The fork by @FelixKratz has been updated to 14.2 (FelixKratz@df5b037)

Yeah but I still get the same error while trying to focus a space using his fork:
cannot focus space due to an error with the scripting-addition.

@kareemlukitomo
Copy link

kareemlukitomo commented Dec 18, 2023

The fork by @FelixKratz has been updated to 14.2 (FelixKratz@df5b037)

Thanks for this. I confirmed to successfully used his fork to correctly run yabai --load-sa on my 14.1.2 macOS Sonoma 14.2 2022 M2 MBA. *edit: had just updated to 14.2 and still works

The steps working for me:

  1. sudo yabai --uninstall-sa && brew uninstall koekeishiya/formulae/yabai uninstall the brew-version of yabai first
  2. git clone https://github.com/FelixKratz/yabai cloned his fork
  3. cd yabai && make all manually build the new/patched-yabai's binary
  4. cd bin && sudo mv yabai /usr/local/bin/yabai moved this to $PATH (I think this is optional because somehow I need to manually specify the absolute path of the new yabai binary in my .skhdrc; up next)
  5. nvim ~/.skhdrc replace the "yabai" executable with absolute paths /usr/local/bin/yabai
  6. Restart macOS
  7. sudo yabai --load-sa && yabai run the new yabai. Maybe also try brew services restart skhd

Finally able to enjoy instantaneous space-switching again 🤭 hope this helps anyone. Hopefully later I able to help merge this diff to yabai's main branch. *edit: I meant only the scripting-addition fix, not Felix's personal patches of course.

@Jacky-Lzx
Copy link

The fork by @FelixKratz has been updated to 14.2 (FelixKratz@df5b037)

Thanks for this. I confirmed to successfully used his fork to correctly run yabai --load-sa on my 14.1.2 macOS Sonoma 14.2 2022 M2 MBA. *edit: had just updated to 14.2 and still works

The steps working for me:

  1. sudo yabai --uninstall-sa && brew uninstall koekeishiya/formulae/yabai uninstall the brew-version of yabai first
  2. git clone https://github.com/FelixKratz/yabai cloned his fork
  3. cd yabai && make all manually build the new/patched-yabai's binary
  4. cd bin && sudo mv yabai /usr/local/bin/yabai moved this to $PATH (I think this is optional because somehow I need to manually specify the absolute path of the new yabai binary in my .skhdrc; up next)
  5. nvim ~/.skhdrc replace the "yabai" executable with absolute paths /usr/local/bin/yabai
  6. Restart macOS
  7. sudo yabai --load-sa && yabai run the new yabai. Maybe also try brew services restart skhd

Finally able to enjoy instantaneous space-switching again 🤭 hope this helps anyone. Hopefully later I able to help merge this diff to yabai's main branch. *edit: I meant only the scripting-addition fix, not Felix's personal patches of course.

This works for me. Previously I tried it but I failed. Now I successfully make it work on my M1 Pro Macbook with Sonoma 14.2.

Below are some notes that may help others:

  1. You can just use the commit FelixKratz@df5b037 as a patch on yabai's latest commit (9fffe01).
  2. You should restart your computer. (I think this is the reason I failed before)
  3. Remember to configure the scripting addition as described here.

@SzymonMielecki
Copy link

The fork by @FelixKratz has been updated to 14.2 (FelixKratz@df5b037)

Thanks for this. I confirmed to successfully used his fork to correctly run yabai --load-sa on my 14.1.2 macOS Sonoma 14.2 2022 M2 MBA. *edit: had just updated to 14.2 and still works

The steps working for me:

  1. sudo yabai --uninstall-sa && brew uninstall koekeishiya/formulae/yabai uninstall the brew-version of yabai first
  2. git clone https://github.com/FelixKratz/yabai cloned his fork
  3. cd yabai && make all manually build the new/patched-yabai's binary
  4. cd bin && sudo mv yabai /usr/local/bin/yabai moved this to $PATH (I think this is optional because somehow I need to manually specify the absolute path of the new yabai binary in my .skhdrc; up next)
  5. nvim ~/.skhdrc replace the "yabai" executable with absolute paths /usr/local/bin/yabai
  6. Restart macOS
  7. sudo yabai --load-sa && yabai run the new yabai. Maybe also try brew services restart skhd

Finally able to enjoy instantaneous space-switching again 🤭 hope this helps anyone. Hopefully later I able to help merge this diff to yabai's main branch. *edit: I meant only the scripting-addition fix, not Felix's personal patches of course.

how do you detach it so that it can run in the background?
/usr/local/bin/yabai --start-service does nothing

@alpiua
Copy link

alpiua commented Dec 18, 2023

@kareemlukitomo thanks, it works. But for some reason I can see a strange overlap on the second screen for 1 and 2 windows, and it overlap a sketchybar if there is only 1 window on a screen:

image

and join the @SzymonMielecki question - how to make this yabai version work as a service ?

@kareemlukitomo
Copy link

kareemlukitomo commented Dec 18, 2023

Old solution @SzymonMielecki @alpiua this is good enough for me (not exactly running as proper service though, since I don't have a good concept of how background service works on macOS)

https://chat.openai.com/share/348b1fd3-08c8-477a-8a3a-bdac028e6ec6

TL;DR

#!/bin/bash

while true; do
  yabai -c ~/.yabairc
  # Sleep for a bit to avoid rapid restarts in case of immediate failure
  sleep 1
done

Then running this into a detached screen/tmux/zellij session. (Gotta re-run on restart). Feel free to point out/give suggestions on how to improve this guys 👍

*edit: wait that means @Jacky-Lzx's suggestion (to point brew to Felix's yabai commit/patch) would make the background-service mechanism work OOTB? I'll revisit once I got home. Found this though https://github.com/FelixKratz/homebrew-formulae/blob/master/fyabai.rb Still learning how to use it.

See below #2007 (comment)

@kareemlukitomo
Copy link

For now, I'll just use Felix's personal brew formula ✌️ thank you for this @FelixKratz

  1. yabai --uninstall-sa && sudo rm -rf /usr/local/bin/yabai cleanup first
  2. brew tap FelixKratz/homebrew-formulae load this formula
  3. brew install --HEAD felixkratz/formulae/fyabai install it
  4. Configure SA and run yabai as usual
  5. nvim ~/.skhdrc revert the previous changes that I suggested above :b

Is there any benefit in cherry-picking FelixKratz@df5b037 and creating a PR for the master branch in this original repo? Happy to help with this or anything else needed. Cheers!

@Try431
Copy link

Try431 commented Dec 18, 2023

For now, I'll just use Felix's personal brew formula ✌️ thank you for this @FelixKratz

  1. yabai --uninstall-sa && sudo rm -rf /usr/local/bin/yabai cleanup first
  2. brew tap FelixKratz/homebrew-formulae load this formula
  3. brew install --HEAD felixkratz/formulae/fyabai install it
  4. Configure SA and run yabai as usual
  5. nvim ~/.skhdrc revert the previous changes that I suggested above :b

Is there any benefit in cherry-picking FelixKratz@df5b037 and creating a PR for the master branch in this original repo? Happy to help with this or anything else needed. Cheers!

Your original comment worked, but for some reason this updated one didn't for me. I don't mind having a terminal relegated to some workspace that just has yabai running manually, so it's fine for now until SA support gets merged into the main yabai branch.

@rwijtvliet
Copy link

rwijtvliet commented Dec 18, 2023

This seems to fit here, but let me know if I should start a new thread instead:

I'm new to mac and have used yabai as my window manager since I got one this summer. It seems OS updates are a lot more common than I expected, and so-far, unfortunately every update has broken my setup. Is there a way to tell if an OS update will break yabai, before updating? My company aggressively pushes OS updates, and while I can postpone them for a bit, it's cumbersome.

@PrayagS
Copy link

PrayagS commented Dec 19, 2023

Was able to cherry-pick the commit from Felix's fork (https://github.com/PrayagS/yabai/tree/patched-for-14.2) and build the updated binary.

Tried placing the binary at yabai's original location (/opt/homebrew/bin/yabai) hoping that the background service commands would work but they didn't 🥲.

Used this old hack that I used to have when skhd didn't have a background service,

# Start skhd/yabai
if pgrep -x "yabai" >/dev/null
then
else
   yabai
   echo "yabai started"
fi

Placed this in my .zshenv and yabai is running as long as there's a terminal window open.

@boronine
Copy link

I can confirm v6.0.2 works!

Just by eliminating the workspace switching animation, yabai is saving an hour of my life every year, to say nothing of the emotional damage that vanilla macOS window management causes. Yabai is easily providing $100+ of value per year.

Åsmund's work finally inspired me to set up a Patreon account.

Thank you Åsmund! 🙏 🙏 🙏

-----> https://www.patreon.com/aasvi

@marsjane
Copy link

Merry Christmas!! However I updated yabai to v6.0.2, but it seems still not working:

~ ❯ yabai -m space --focus 2
cannot focus space due to an error with the scripting-addition.
~ ❯ yabai --version
yabai-v6.0.2

anything I missed here? I tried to run sudo yabai --load-sa manually, there is no error, just not woking as expected

@boronine
Copy link

@marsjane did you edit your sudoers file after upgrading? In particular, the sha256 must be updated for the new binary

https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)#configure-scripting-addition

@marsjane
Copy link

Oh yes it works! Sorry for missing this, this is the first time I update yabai ;) Many thanks !! @boronine

@TuralAsgar
Copy link

It works!
Thank you!

@Tchoupinax
Copy link

Hey,
With Sonoma 14.2.1, it didn't work. I spent 1 hour to try to make it working again but without any success. The patch and the fork of @FelixKratz worked! Thank you a lot!

@d34dh0r53
Copy link

Was able to cherry-pick the commit from Felix's fork (https://github.com/PrayagS/yabai/tree/patched-for-14.2) and build the updated binary.

Tried placing the binary at yabai's original location (/opt/homebrew/bin/yabai) hoping that the background service commands would work but they didn't 🥲.

Used this old hack that I used to have when skhd didn't have a background service,

# Start skhd/yabai
if pgrep -x "yabai" >/dev/null
then
else
   yabai
   echo "yabai started"
fi

Placed this in my .zshenv and yabai is running as long as there's a terminal window open.

The disown command will let you detach the yabai process from the controlling TTY allowing you to close the terminal window that you launched yabai from. You can run something like:

yabai -V >> /tmp/yabai-HEAD.log 2>&1 & to launch the daemon and then disown will detach the process from your terminal and allow you to close it. Hope this helps :)

@koekeishiya koekeishiya unpinned this issue Jan 3, 2024
@williamhCode
Copy link

I'm trying to get the scripting addition to work with Yabai on macos 14.2.1 with no luck. I setup everything and updated the sudoers file, but it gives this error when i try to run yabai:

yabai: scripting-addition failed to inject payload into Dock.app!

@nagy135
Copy link

nagy135 commented Jan 10, 2024

For now, I'll just use Felix's personal brew formula ✌️ thank you for this @FelixKratz

  1. yabai --uninstall-sa && sudo rm -rf /usr/local/bin/yabai cleanup first
  2. brew tap FelixKratz/homebrew-formulae load this formula
  3. brew install --HEAD felixkratz/formulae/fyabai install it
  4. Configure SA and run yabai as usual
  5. nvim ~/.skhdrc revert the previous changes that I suggested above :b

Is there any benefit in cherry-picking FelixKratz@df5b037 and creating a PR for the master branch in this original repo? Happy to help with this or anything else needed. Cheers!

small note, it just installed different version of yabai and didnt link it to system since I already had brew-installed yabai. So I added brew uninstall yabai and brew link fyabai. (or uninstall after 1. step)

@DamianB-BitFlipper
Copy link

It works on yabai 6.0.2 following https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)#configure-scripting-addition . Thanks so much for the quick fixes!

@benjypng
Copy link

I would like to confirm that scripting addition on 6.0.6 works.

@leohxj
Copy link

leohxj commented Jan 11, 2024

I would like to confirm that scripting addition on 6.0.6 works.
no

@weeebdev
Copy link

@koekeishiya is yabai managed by homebrew services or plist for now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests