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

zsh:1: command not found: yabai #350

Open
lukebarton opened this issue Apr 21, 2024 · 5 comments
Open

zsh:1: command not found: yabai #350

lukebarton opened this issue Apr 21, 2024 · 5 comments

Comments

@lukebarton
Copy link

lukebarton commented Apr 21, 2024

I've got yabai and skhd installed via brew and I've got zsh configured by nix w/ home-manager.
I'm running the service via skhd --(start|restart|stop)-service.

The plist includes the homebrew prefix (/opt/homebrew/bin:/opt/homebrew/sbin:) in the PATH environment variable and echo $PATH from the shell returns /opt/homebrew/bin:/opt/homebrew/sbin:.. as expected.

Debugging skhd using: alt - p : echo $PATH, the /tmp/skhd_*.out.log does NOT include the homebrew prefix on the path. I don't understand why. It's in the plist for the service and it's also in my shell. What could I be missing that would mean it's not on the PATH of the service's zsh call?

@lukebarton
Copy link
Author

lukebarton commented Apr 21, 2024

I can work around this by alt - p : eval $(/opt/homebrew/bin/brew shellenv) && yabai ... but it'd be good to resolve it correctly.

I suspect it has something to do with not-sourcing-.zshrc with a non-interactive shell. But to count against that, even forcing interactive shell with alt - o : /bin/zsh -ic 'echo $PATH' doesn't help (which might not work anyway for other reasons). I'm kinda at a loss. I probably need to spend a weekend learning more about shells and zsh.

@tymscar
Copy link

tymscar commented Apr 30, 2024

If you're already using homemanager, why not use nix-darwin and let that manage both yabai and skhd for you? That might fix the path issues because you wont depend on homebrew anymore for this.

@lukebarton
Copy link
Author

Because package versions.

In the end I’m no longer using Yabai. Instead I’m using AeroSpace, which is more suitable for my use cases.

@avrahamappel
Copy link

Noticing a similar issue.

I'm using skhd to set a hotkey to open Alacritty. While the hotkey works, I've noticed that shift-clicking on any urls within the terminal doesn't open the url, instead it errors:

Screenshot 2024-06-06 at 3 26 09 PM

The reason appears to be that Alacritty is calling open, and for some reason that command is not in the $PATH.

I also noticed when setting up the hotkey that it was necessary to call /usr/bin/open instead of plain open to launch the application.

Confirmed using the debug hotkey shown above that skhd's PATH does not contain /usr/bin (or any other system path for that matter, only Nix store paths. Maybe because the daemon is started by home-manager?)

My hotkey looks like this:

# if there's already an instance running, open new window, otherwise start a new instance
ctrl + cmd - return : /nix/store/xx9zzx3a9v96yxkbg5b85yb1m7x69gl5-alacritty-local/bin/alacritty msg create-window 2>&1 || /usr/bin/open -a /nix/store/xx9zzx3a9v96yxkbg5b85yb1m7x69gl5-alacritty-local/Applications/Alacritty.app

@avrahamappel
Copy link

Turned out my issue was that the PATH key of skhd's plist file did not include any system paths. Reran skhd --uninstall-service; skhd --install-service and all's well

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

3 participants