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 failed to inject #1158

Closed
SichangHe opened this issue Feb 15, 2022 · 12 comments
Closed

scripting-addition failed to inject #1158

SichangHe opened this issue Feb 15, 2022 · 12 comments

Comments

@SichangHe
Copy link

scripting-addition failed to inject

$ yabai -m space --focus next
cannot focus space due to an error with the scripting-addition.
$ sudo yabai --load-sa 
Password:
yabai: scripting-addition failed to inject payload into Dock.app!

version

yabai-v4.0.0
macOS 12.01
M1 apple silicon

SIP is disabled

same problem from others

this is migrated from comments on #787
@alephpt and @rublev has the problem, but on macOS 12.2

@francocalvo
Copy link

Hey! I had this very problem and just solved it. When you add the line to the visudo yabai file, replace the path from yabai to the output of which yabai as it appear that they can be different. After that just restart!

@SichangHe
Copy link
Author

Hey! I had this very problem and just solved it. When you add the line to the visudo yabai file, replace the path from yabai to the output of which yabai as it appear that they can be different. After that just restart!

I am afraid that we must have different problems.

Your problem seems to be that you were calling the wrong yabai.
My problem is that I called the right yabai and failed.

@Tweoss
Copy link

Tweoss commented Mar 7, 2022

@SichangHe Have you taken a look at the #1054 issue yet? I had the same issues and error messages (I'm on M1 12.2.1) but managed to solve it with some commands. Check out this code block. Hopefully that can solve your issue (this command sudo nvram boot-args=-arm64e_preview_abi specifically might help).

@SichangHe
Copy link
Author

@SichangHe Have you taken a look at the #1054 issue yet? I had the same issues and error messages (I'm on M1 12.2.1) but managed to solve it with some commands. Check out this code block. Hopefully that can solve your issue (this command sudo nvram boot-args=-arm64e_preview_abi specifically might help).

After executing the code in the code block you mentioned (copied below), I was able to focus next window ✌️

sudo nvram boot-args=-arm64e_preview_abi
# reboot
sudo yabai --uninstall-sa
sudo yabai --install-sa
sudo yabai --load-sa

It seems that, for M1,

sudo nvram boot-args=-arm64e_preview_abi

is needed for the script addition to work.

which is not mentioned in the installation part of the wiki.

I will suggest adding the code to the wiki

@SichangHe
Copy link
Author

I tried Automatically load scripting addition on startup and it does not work upon reboot

$ yabai -m space --focus next
yabai-msg: failed to connect to socket..

After quitting Finder and opening it again, which supposedly trigger the script addition to load again, it becomes

$ yabai -m space --focus next
cannot focus space due to an error with the scripting-addition.

It works, however, if I manually do

sudo yabai --load-sa

what I did according to Automatically load scripting addition on startup

sudo visudo -f /private/etc/sudoers.d/yabai

add this line to the opened file

sichanghe ALL = (root) NOPASSWD: /opt/homebrew/bin/yabai --load-sa

add these two lines to yabairc

sudo /opt/homebrew/bin/yabai --load-sa
yabai -m signal --add event=dock_did_restart action="sudo /opt/homebrew/bin/yabai --load-sa"

@Tweoss
Copy link

Tweoss commented Mar 7, 2022

Hi @SichangHe

It seems that, for M1,

sudo nvram boot-args=-arm64e_preview_abi

is needed for the script addition to work.

which is not mentioned in the installation part of the wiki.

It is in fact mentioned in the wiki, though a bit lower down. Check this page.

 yabai -m space --focus next

yabai-msg: failed to connect to socket..

Are you running yabai manually or via brew services start yabai? If the former, then you need to make sure to start yabai in the command line before trying to focus spaces. I believe the latter is recommended (definitely more hands off).

Your yabairc addition looks about right, you might have to reboot your computer for the visudo to take effect. I assume that you're using the path of yabai from which yabai in there (I have a different path /usr/local/bin/yabai)?

@SichangHe
Copy link
Author

@Tweoss

It is in fact mentioned in the wiki, though a bit lower down.

I see it now. I missed it because I already disabled SIP before I started following the wiki and I skipped the SIP part.
I would say that this configuration and SIP are usually considered two different aspects. So, the way the wiki is managed is confusing.

Are you running yabai manually or via brew services start yabai?

I use brew to manage both yabai and skhd

Your yabairc addition looks about right, you might have to reboot your computer for the visudo to take effect.

I rebooted twice.

I assume that you're using the path of yabai from which yabai in there.

You are right about this.

@Tweoss
Copy link

Tweoss commented Mar 7, 2022

I see it now. I missed it because I already disabled SIP before I started following the wiki and I skipped the SIP part.
I would say that this configuration and SIP are usually considered two different aspects. So, the way the wiki is managed is confusing.
I agree, that little snippet is pretty hard to locate.

I use brew to manage both yabai and skhd

Interesting, I figured that brew ought to have started yabai, so you wouldn't need to quit Finder (or pkill Dock). Does yabai work now without manually killing Finder?

@SichangHe
Copy link
Author

Interesting, I figured that brew ought to have started yabai, so you wouldn't need to quit Finder (or pkill Dock). Does yabai work now without manually killing Finder?

I killed and restarted Finder to trigger this in the yabairc to see if it works

yabai -m signal --add event=dock_did_restart action="sudo /opt/homebrew/bin/yabai --load-sa"

yabai is started by brew no problem, and yabai works after manually running sudo yabai --load-sa.
(It causes some buggy window behaviors though)

@SichangHe
Copy link
Author

Since the topic of this issue, scripting-addition failed to inject, is solved by this.
I am closing this issue.

@palteksolution
Copy link

Since the topic of this issue, scripting-addition failed to inject, is solved by this. I am closing this issue.

On Macos Ventura, I try all the ways but it still failed.

@natikgadzhi
Copy link

@palteksolution, the Ventura scripting addition was just fixed in this commit, but it's not released yet: 206c0d6

brew unlink yabai
brew install yabai --head
sudo yabai --load-sa

Don't forget to update your sudoers config with the new sha hash of yabai binary, though.

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

5 participants