purcell / exec-path-from-shell

Make Emacs use the $PATH set up by the user's shell
Other
1.43k stars 82 forks source link

Exec-path-from-shell not calling correct shell #92

Closed jonathanabennett closed 5 years ago

jonathanabennett commented 5 years ago

I am using this package to pull my $PATH from zsh. It appears to be calling the wrong shell when I run it. Here is the section in my init.el:

(use-package exec-path-from-shell
  :ensure t
  :init
  (setq exec-path-from-shell-debug t)
  (setenv "SHELL" "/usr/local/bin/zsh")
  (message "Should be running exec-path-from-shell-initialize")
  (exec-path-from-shell-initialize))

Here is the output of the message buffer after loading emacs:

Should be running exec-path-from-shell-initialize
Invoking shell /bin/bash with args ("-l" "-i" "-c" "/usr/bin/printf '__RESULT\\000%s\\000%s\\000__RESULT' \"${PATH-01cebe267a47d90eb338a4c6cf73d5fa}\" \"${MANPATH-01cebe267a47d90eb338a4c6cf73d5fa}\"")
Shell printed: "__RESULT/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_14:/Applications/Emacs.app/Contents/MacOS/libexec-x86_64-10_1401cebe267a47d90eb338a4c6cf73d5fa__RESULT"
Invoking shell /bin/bash with args ("-l" "-c" "/usr/bin/printf '__RESULT\\000%s\\000%s\\000__RESULT' \"${MANPATH-8c743e1c89b13ce1ae62a2e0f0494908}\" \"${PATH-8c743e1c89b13ce1ae62a2e0f0494908}\"")
Shell printed: "__RESULT8c743e1c89b13ce1ae62a2e0f0494908/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_14:/Applications/Emacs.app/Contents/MacOS/libexec-x86_64-10_14__RESULT"

As you can see, even though I set the SHELL immediately before calling exec-path-from-shell-initialize, it is calling the wrong shell.

OS: 10.14.5 Mojave Emacs: 26.2

jonathanabennett commented 5 years ago

OK, it appears that when I reinstalled emacs, the variable shell-file-name was set to "/bin/bash".

Changing that to my intended shell corrects the problem. Apologies for raising an unnecessary issue.

purcell commented 5 years ago

All good, glad you figured it out.