Git is not using the first editor in my $PATH

Posted by GuillaumeA on Stack Overflow See other posts from Stack Overflow or by GuillaumeA
Published on 2012-11-09T02:25:18Z Indexed on 2012/11/10 23:00 UTC
Read the original article Hit count: 212

Filed under:
|
|
|
|

I am using OS X 10.8, and I used brew to install a more recent version of emacs than the one shipped with OS X.

The newer emacs binary is installed in /usr/local/bin (24.2.1), and the old "shipped-with-osx" one in /usr/bin (22.1.1).

I updated my $PATH env variable by prepending /usr/local/bin to it. It works fine in my shell (ie. typing emacs runs the 24.2.1 version), but when git opens the editor, the emacs version is 22.1.1.

Isn't git supposed to use $PATH to find the editor I want to use ?

Additional informations:

$ type -a emacs
emacs is /usr/local/bin/emacs
emacs is /usr/bin/emacs
emacs is /usr/local/bin/emacs
$ env
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
SHELL=/bin/zsh
PAGER=most
EDITOR=emacs -nw
_=/usr/bin/env

Please note that I'd prefer not to set the absolute path of my editor directly in my git conf, as I use this conf across multiple systems.

EDIT: Here's an bit of my .zshrc:

# Mac OS X
if [ `uname` = "Darwin" ]; then
    # Brew binaries
    PATH="/usr/local/bin":"/usr/local/sbin":$PATH
else # Everyone else (Linux)
    # snip
fi

So, yes, I could add a line export EDITOR='/usr/local/bin emacs -nw' in the first if, but I'd like to understand why git is not using my PATH variable :)

© Stack Overflow or respective owner

Related posts about osx

Related posts about git