Gosin · 2022-12-31 05:35
Hi all, I'm using Emacs 28 on Mac OS Ventura.
I have installed tree-sitter cli from rust cargo, but when I try to call it from eshell, it said it cannot find the executable. It's fine in the iTerm2.
I have installed package exec-path-from-shell to copy shell's environment PATH for Emacs to use.
And I have checked the $PATH in the eshell which contains cargo binary directory and I can call tree-sitter cli using the absolute path.
Any idea why eshell cannot find the executable? (I have also tried to add the directory to 'exec-path but it still cannot find it.
​
https://preview.redd.it/ina8bskc769a1.png?width=766&format=png&auto=webp&s=aae2952bf9cef3e0e0c424efa32f0abceae2163a
hangingpawns · 2022-12-31 07:13
Does eshell use the PATH variable? Different shells use different envars.
https://emacs.stackexchange.com/questions/461/configuration-of-eshell-running-programs-from-directories-in-path-env-variable
LionyxML · 2022-12-31 15:29
All my path related problems with emacs on macOS were solved with the package: https://github.com/purcell/exec-path-from-shell
Just put this in your init file:
(exec-path-from-shell-initialize)
Gosin · 2022-12-31 17:03
u/hangingpawns and u/LionyxML , Thanks for your replies.
I have figured this out.
1. First, eshell seems doesn't utilize $PATH to search for executable (Not entirely sure. but from what I see, it doesn't use $PATH. )
2. 'exec-path is actually used, but I added cargo directory as the last entry. According to the documentation, last entry in 'exec-path is not always used like in shell completion (which I think also affect shell command). After adding default directory as last entry. Eshell can find the executable just fine.
[The screenshot for the fix](https://ibb.co/RyYXGW5)
mmaug · 2022-12-31 20:14
Is Emacs being started as a service rather than being run explicitly from a shell prompt? It should like the changes you make to PATH haven't been done when Emacs starts. If you start Emacs from the shell does it find tree-sitter?
vfclists · 2022-12-31 22:26
> After adding default directory as last entry. Eshell can find the executable just fine.
Unless the screenshot with the help info is view readers may not know that `exec-path` treats `nil` as `default-directory`.
tabfugnic · 2022-12-31 22:53
I had a similar issue to this on my setup, but my issue was that all of emacs was unaware of my $PATH or really any of my environment variables except a few. I finally figured out that my .bashrc wasn't loading properly, probably obvious in retrospect. I had to add the necessary ENV to my .profile. might not be the same issue, but I would look into what's being loaded, it might not be what you expect.