jitouch icon indicating copy to clipboard operation
jitouch copied to clipboard

Jitouch not launching automatically due to lack of permissions

Open shp7724 opened this issue 1 year ago • 7 comments

Hello,

These days I've been experiencing some issues where Jitouch would not launch on start up in my new m1 macbook. I had to manually run the app via terminal with the following command:

nohup /Library/PreferencePanes/Jitouch.prefPane/Contents/Resources/Jitouch.app/Contents/MacOS/Jitouch &

Reading through the readme, issues, and all the troubleshooting guide you provided, I found that this is because LaunchAgents are not set up correctly. All these command gave me no results related to Jitouch:

launchctl list | grep jitouch
cd /Library/LaunchAgents
cd ~/Library/LaunchAgents

Interestingly, even if I run Jitouch manually and set the log level to Debug, I was not able to find any logs at ~/Library/Logs/com.jitouch.Jitouch.prefpane.log and /Library/Logs/com.jitouch.Jitouch.prefpane.log

So I built the app from the source, ran it, and was able to create the log:

2023-05-01 02:00:32.695 legacyLoader-arm64[11760:49882] Jitouch prefPane opened
2023-05-01 02:00:32.697 legacyLoader-arm64[11760:49882] Updated LaunchAgent at /Users/user/Library/LaunchAgents/com.jitouch.Jitouch.plist
Unload failed: 5: Input/output error
Try running `launchctl bootout` as root for richer errors.
Load failed: 5: Input/output error
Try running `launchctl bootstrap` as root for richer errors.
2023-05-01 02:00:32.730 legacyLoader-arm64[11760:49882] Reloaded LaunchAgent at /Users/user/Library/LaunchAgents/com.jitouch.Jitouch.plist
2023-05-01 02:01:07.976 legacyLoader-arm64[14389:55619] Jitouch prefPane opened
Unload failed: 5: Input/output error
Try running `launchctl bootout` as root for richer errors.
2023-05-01 02:01:07.986 legacyLoader-arm64[14389:55619] Error creating LaunchAgent at /Users/user/Library/LaunchAgents/com.jitouch.Jitouch.plist: ‘LaunchAgents’ 폴더에 ‘com.jitouch.Jitouch.plist’ 파일을 저장할 수 있는 권한이 없습니다.
Load failed: 5: Input/output error
Try running `launchctl bootstrap` as root for richer errors.
2023-05-01 02:01:08.001 legacyLoader-arm64[14389:55619] Reloaded LaunchAgent at /Users/user/Library/LaunchAgents/com.jitouch.Jitouch.plist
No matching processes belonging to you were found
Load failed: 5: Input/output error
Try running `launchctl bootstrap` as root for richer errors.

The error message in Korean can be translated into You don't have permissions to save 'com.jitouch.Jitouch.plist' file in 'LaunchAgents' folder.. Note that I have Jitouch enabled in my Settings > Privacy > Accessibility list.

Now I'm stuck here. Can you help me trace down the issue? Thanks.

shp7724 avatar Apr 30 '23 17:04 shp7724

Can you check if the folder ~/Library/LaunchAgents exists and that you have permissions to write to it? What is the output of ls -la ~/Library/LaunchAgents?

Also, the latest versions of macOS put extra restrictions on LaunchAgents. Do you see "Aaron Kollasch > 1 item" in General > Login Items and is it enabled?

aaronkollasch avatar Apr 30 '23 18:04 aaronkollasch

Can you check if the folder ~/Library/LaunchAgents exists and that you have permissions to write to it? What is the output of ls -la ~/Library/LaunchAgents?

Both ~/Library/LaunchAgents and /Library/LaunchAgents folder exist, and I have plist files for other third party applications except Jitouch's.

Giving the write access with sudo chmod 777 LaunchAgents did let Jitouch successfully create it's plist file (I can see my name in General > Login Items because the app is signed with my dev account), but I still see Input/output errors in the log. There is no Ji icon in the menu bar.

2023-05-01 08:53:37.023 legacyLoader-arm64[34916:586026] Jitouch prefPane opened
Unload failed: 5: Input/output error
Try running `launchctl bootout` as root for richer errors.
2023-05-01 08:54:42.314 legacyLoader-arm64[35239:587867] Jitouch prefPane opened
2023-05-01 08:55:02.996 legacyLoader-arm64[35239:587880] setLegacyPreferencePanePath: /Library/PreferencePanes/Jitouch.prefPane
Load failed: 5: Input/output error
Try running `launchctl bootstrap` as root for richer errors.

Here's the result of ls -la .:

➜  LaunchAgents ls -la .
total 16
drwxrwxrwx@   4 root  staff   128  5  1 08:53 .
drwx------@ 106 user  staff  3392  4 30 00:57 ..
-rw-r--r--@   1 user  staff   741  5  1 08:53 com.jitouch.Jitouch.plist
-rw-r--r--    1 user  staff   610  1  6 11:08 net.pulsesecure.SetupClient.plist

Update

After giving the write permissions, reinstalling Jitouch with official package does seem to resolve the issue. Although I still wonder why this became an issue for Jitouch, I think you can close this issue. Thank you for the help!

shp7724 avatar May 01 '23 00:05 shp7724

Ok, great! I was going to suggest manually loading and unloading the plist with launchctl, like so:

launchctl unload ~/Library/LaunchAgents/com.jitouch.Jitouch.plist
launchctl load ~/Library/LaunchAgents/com.jitouch.Jitouch.plist

Perhaps reinstallation ended up doing something similar, and the difference from the first try is that you have the login item enabled this time? Anyway, thanks for reporting!

aaronkollasch avatar May 01 '23 00:05 aaronkollasch

Also, feel free to put write permissions for the LaunchAgents folder back to their original state - the plist shouldn't need to be changed now. It is odd that you had to change the permissions to get it to write the file. Do you know if enabling the launch agent in System Settings was involved?

aaronkollasch avatar May 01 '23 00:05 aaronkollasch

the difference from the first try is that you have the login item enabled this time?

Before reinstalling, I deleted the launch agent (plist) so I believe it's not the case.

Do you know if enabling the launch agent in System Settings was involved?

What do you mean by "enabling the launch agent in System Settings"? I didn't try to manually load launch agents via terminal, nor to toggle on/off in Settings. All I did was giving the write permission to LaunchAgents folder.

One difference I noticed when reinstalling with official package was, the package installer now prompted me to select which user(i.e. global or user) to install Jitouch for. Before giving the permission, I tried reinstalling numerous times, but I had never encountered such a step. That being said, I don't understand how it's relevant in this case.

shp7724 avatar May 01 '23 03:05 shp7724

Which version of macOS are you using? Monterey adds an on/off permission switch for each launch agent in General > Login Items.

aaronkollasch avatar May 01 '23 20:05 aaronkollasch

I'm using Ventura 13.2, and yes I have the toggle switches in Login Items. But I didn't manually enable the launch agent. It was enabled from the beginning.

shp7724 avatar May 01 '23 23:05 shp7724