Bug 504753 - PATH is not set correctly when Kate is launched graphically
Summary: PATH is not set correctly when Kate is launched graphically
Status: RESOLVED DUPLICATE of bug 490926
Alias: None
Product: kate
Classification: Applications
Component: general (other bugs)
Version First Reported In: 25.04.1
Platform: Homebrew (macOS) macOS
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-25 01:38 UTC by hatzka
Modified: 2025-05-26 05:10 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hatzka 2025-05-25 01:38:11 UTC
SUMMARY
I have added some paths (to Homebrew binaries specifically) to /etc/paths.d . It seems like every macOS application inherits them automatically once they are there, except for Kate.

STEPS TO REPRODUCE
1. Add a path to /etc/paths.d .
2. Launch Kate.
3. Observe the PATH in the Output tab. 

OBSERVED RESULT
When Kate is launched graphically (from the dock, Spotlight, etc), its PATH is /usr/bin:/bin:/usr/sbin:/sbin , but when launching it from the command line it inherits the PATH from the terminal.

EXPECTED RESULT
When Kate is launched graphically, its PATH should be the same as the PATH other applications get when launched graphically.

SOFTWARE/OS VERSIONS
macOS: 15.5
KDE Frameworks Version: 6.14.0
Qt Version: 6.8.3

ADDITIONAL INFORMATION
This might not be the usual way of adding PATH entries globally on macOS. I had some trouble finding docs.
Comment 1 Waqar Ahmed 2025-05-26 04:24:19 UTC
We added "PATH" setting for exactly this reason. Please use the settings under "Settings -> Configure Kate .. -> Behavior -> PATH" to modify the path variable to your needs.
Comment 2 hatzka 2025-05-26 04:48:35 UTC
Thank you for the easier workaround. That said, I'm reopening this because it is, in the end, only a workaround. On any other platform that had a system-wide PATH setting, it would be a bug if Kate simply ignored it. The description of the setting even says "This list will be prepended to your PATH environment variable", which simply isn't true right now.
Comment 3 Waqar Ahmed 2025-05-26 05:10:07 UTC
> Thank you for the easier workaround. That said, I'm reopening this because it is, in the end, only a workaround.

Well, this is the solution we have for now. We tried many other things but there are issues such as path precedence among other things that I dont recall. There were almost 0 documentation that I found on how to do this properly.

If you have a better solution or a way to fix the problem, then we accept patches here: https://invent.kde.org/utilities/kate/-/merge_requests.

> "This list will be prepended to your PATH environment variable", which simply isn't true right now.

It kind of is in a way as the PATH isn't what you would find in your shell. The PATH env var here refers to the data returned by:

        int mib[2] = {CTL_USER, USER_CS_PATH};
        size_t len = 0;
        sysctl(mib, 2, nullptr, &len, nullptr, 0);
        QByteArray path(len, '\0');
        sysctl(mib, 2, &path[0], &len, nullptr, 0);

Sorry, this is it for now unless someone comes with a better solution.

*** This bug has been marked as a duplicate of bug 490926 ***