Closed galderz closed 9 years ago
exec-path-from-shell
will run zsh like zsh -l -i -c ...' by default, so it will set $PATH in Emacs to the result of running
zsh -l -i -c 'echo $PATH'. You can try running that command directly inside Emacs using
M-!` to see what it outputs.
Re. $TERM, this module does nothing with that env var by default, so you'll need to look elsewhere for what's going on with that.
P.S. I'm also a zsh
user, and have not experienced any of these issues, so most likely the problem is the particular way you've organised your zsh startup files.
I have a similar problem. However, M-x ! echo $PATH
returns a different result than M-x ! zsh -l -i -c 'echo $PATH'
. Is this by design?
I have a similar problem. However, M-x ! echo $PATH returns a different result than M-x ! zsh -l -i -c 'echo $PATH'. Is this by design?
Before or after running exec-path-from-shell-initialize
? What's the result of evaluating (getenv "SHELL")
? More information is necessary here for me to provide any help here.
I don't load exec-path-from-shell-initialize
since it does not seem to set the correct path.
(getenv "SHELL")
returns "/usr/local/bin/zsh"
Your zsh config probably says something like PATH=$PATH:...
. So any $PATH inside Emacs will be included in the output of zsh -c 'echo $PATH'
. If that's the case, just set $PATH
absolutely in your ~/.zshenv
, without referring to the inherited $PATH
, ie. do something like PATH=/usr/local/bin:/usr/bin:/bin
.
GNU Emacs 24.5.1 (x86_64-apple-darwin13.4.0, Carbon Version 157 AppKit 1265.21) of 2015-05-01
I'm using oh-my-zsh config. I don't have .zshenv
. However, my .zshrc
has the following related to the PATH:
export PATH=/usr/local/bin:$PATH export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH" source $ZSH/oh-my-zsh.sh
Could you please elaborate on this statement: "..just set $PATH absolutely in your ~/.zshenv, without referring to the inherited $PATH, ie. do something like PATH=/usr/local/bin:/usr/bin:/bin."
I also updated the .profile
as follows:
export PATH=/usr/local/bin:$PATH export PATH=/usr/local/sbin:$PATH export SHELL="/usr/local/bin/zsh" export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH" if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
When you start Emacs, it has some kind of $PATH. So then when you run zsh inside Emacs, your zsh config inserts that value of $PATH. Imagine $PATH in Emacs is "BLAH" -- then export PATH=/usr/local/bin:$PATH
will set $PATH
in zsh to /usr/local/bin:BLAH
. So don't do that. Just set PATH
in your zsh config to exactly the final value you want.
I understand, I think, your logic.
But all $PATH
values are set to be prepended, not appended in all rc
files I use. This would make it impossible to have this value of PATH
, because I'm prepending usr/local/bin
:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/Cellar/fzf/0.9.4-1/bin:/usr/local/opt/coreutils/libexec/gnubin
The exec-path
variable within Emacs is set to:
("/usr/local/Cellar/fzf/0.9.4-1/bin/" "/usr/local/opt/coreutils/libexec/gnubin/" "/usr/local/bin/" "/usr/bin/" "/bin/" "/usr/sbin/" "/sbin/" "/usr/local/bin/" "/usr/local/Cellar/emacs-mac/emacs-24.5-z-mac-5.7/libexec/emacs/24.5/x86_64-apple-darwin13.4.0/")
I.e. I don't see where Emacs takes usr/bin
from at the beginning.
Another piece to the puzzle:
M x ! echo $PATH
returns:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/Cellar/fzf/0.9.4-1/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/sbin
M x exec-path-from-shell-initialize
M x ! echo $PATH
returns:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/sbin:/usr/local/Cellar/fzf/0.9.4-1/bin
Emacs prepends certain elements of its own to its $PATH at startup. Nonetheless, if you set PATH=/usr/bin:/bin
in your config, then run exec-path-from-shell-initialize
, you will get that same value for $PATH in Emacs afterwards.
I'm having issues with my ZSH shell $PATH and the $PATH from within Emacs on OSX. I've created a Stackoverflow post where I explain all the details. I've tried using your module but it does not work, it changes nothing on the $PATH variable.
On top of that, running your module has the side effect of messing up or clearing my
.zprofile
settings ofexport TERM=xterm-256color
since my theme appears with 16 colours when it runs.