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

Service fails to install if ~/Library/LaunchAgents doesn't exist #1728

Closed
aouerf opened this issue May 3, 2023 · 5 comments
Closed

Service fails to install if ~/Library/LaunchAgents doesn't exist #1728

aouerf opened this issue May 3, 2023 · 5 comments

Comments

@aouerf
Copy link

aouerf commented May 3, 2023

This issue seems to be because the plist path is opened without checking if the directory exists:

yabai/src/misc/service.h

Lines 96 to 97 in f4ad453

FILE *handle = fopen(yabai_plist_path, "w");
if (!handle) return 1;

I believe the user experience here could be a bit better. I can make a PR for this when I get the chance, but I'm filing this issue in case someone can get to it before I do.

The same issue predictably exists for skhd.

@koekeishiya
Copy link
Owner

koekeishiya commented May 3, 2023

Fairly certain this folder will always exist unless a user has specifically decided to delete it, in which case I think failing is better than recreating it.

@aouerf
Copy link
Author

aouerf commented May 3, 2023

It didn't exist after a fresh install of macOS, which is why I filed this issue since I had to dig in to figure out why it wasn't working since the error message wasn't very intuitive. I can definitely see where you're coming from though, so feel free to close this if you want to leave things as is.

@koekeishiya
Copy link
Owner

I assumed it would always be there (even after a fresh install) when reading Apple documentation, but as you pointed out that appears to not be the case.

I've changed the implementation on master to attempt to create the LaunchAgents folder if necessary before writing the file. Same change has been applied to skhd.

I am not going to push a new release just for this change though.

@koekeishiya koekeishiya added the addressed on master; not released Fixed upstream, but not yet released label May 3, 2023
@plotchy
Copy link

plotchy commented May 6, 2023

Thanks for reporting this, I ran into this issue just now on a fresh install.

@vhagedorn
Copy link

Sorry for necro, but adding on to the solution:

If the directory did not exist, and the user had created it manually (as in my case), the permissions would not allow the process to write to the directory. This can be fixed with a simple chmod 775.

I encoutered this issue with skhd, but these appear to have the same impl, so I'm leaving my comment here.

Cheers
-vadim

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

4 participants