Git doesn't use the first editor in my $ PATH

I use OS X 10.8 and I used brew to install a newer version of emacs than the one that comes with OS X.

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

I updated the $PATH env variable by adding /usr/local/bin . It works fine in my shell (i.e. typing emacs launches version 24.2.1), but when git opens the editor, the emacs version is 22.1.1.

Should git use $PATH to find the editor I want to use?

Additional Information:

 $ 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 would prefer not to set the absolute path of my editor directly in my git conf, since I use this conf for multiple systems.

EDIT : Here's a 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 the line export EDITOR='/usr/local/bin emacs -nw' to the first if , but I would like to understand why git not using my PATH variable :)

+2
git editor homebrew path macos
source share
2 answers

Installing git 1.8.0 fixed the problem.

The old version was 1.7.9.6 (Apple Git-31.1) . This is strange since I did not find references to this problem in the change lists.

+2
source share

The simplest solution is to set the full path to the environment variable.

OSX uses bash (1) by default, so stick with export EDITOR=/usr/local/bin/emacs -nw somewhere in your .bash_profile to set a variable for all interactive bash shells.

0
source share

All Articles