yabai: “brew services …” doesn’t start yabai and doesn’t correctly reflect service status, while direct invocation works
brew services start|stop commands behave as if the service can be started, stopped and is running successfully, but yabai -m commands complain about failure to connect to socket.
However, socket file does exist under /tmp.
Socket file does not get created while the service is shown as “started” by brew services.
While service is supposedly running, there appears to be no yabai process.
me@machine:~$ ps aux | fgrep yabai
me            11778   0.0  0.0  4399356    796 s005  S+   11:01PM   0:00.00 fgrep yabai
When running yabai directly, yabai -m commands succeed, and socket file gets created.
Ideally, at least services could somehow accurately reflect if yabai fails to start…
Background
I install brew packages while su’ing as another user with admin privileges, but without root/sudo. I run binaries as my regular user. Never had a problem with that before.
I tried starting yabai service from (1) my regular user, from (2) that admin user, and from (3) admin user + sudo. (2) fails loudly, (3) declares that it takes root ownership over some files but otherwise succeeds (since it screwed up permissions, I assume, I wiped and reinstalled yabai after that just in case). (1) succeeds as described in the beginning of the issue. In all cases, yabai -m failed.
SIP
I did not disable SIP or install the scripting addon, so there’s that. I want to get started with yabai in restricted functionality.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 15 (2 by maintainers)
I had the same issue, and it stems from installing brew packages from a separate ‘admin’ user, while starting the yabai brew service as a ‘regular’ user.
The yabai installation creates this folder for logs, but the ‘regular’ user does not have privileges to write files to it:
The plist file that comes with yabai specifies two log files in this directory, to which the yabai service will try to write at startup but will fail to do so causing yabai to terminate:
A quick fix for this issue is to pre-create the log files and change their ownership to the ‘regular’ user:
@koekeishiya would you consider not terminating yabai even if stdout and stderr are not writeable?
For me the issue was caused by
/opt/homebrewhaving the wrong ownershipsudo chown -R $(whoami) /opt/homebrewfixed itI faced this exact issue with Catalina. Tried the workaround above but it didn’t help. So, I decided to create a group named
brewand then give it permissions to the folders used by brew services.brewfor obvious reasons.This should allow this new group permissions to run brew without any issues, thereby solving the permissions issue that causes yabai not to activate upon startup.