Cannot find git executable

I am using Emacs 24 on OS X 10.6.8. Running magit-status says

Search for a program: no such file or directory, git

However, the Emacs shell can find git , so this is not a $PATH problem. What else could it be?

+4
source share
2 answers

Try checking the value of the exec-path variable. This manages the directories that are viewed by Emacs for external executables (including git).

This is a custom variable, and you can add the path to git to the list of existing directories.

I have an elisp fragment in my .emacs.d/init.el for my installation of Emacs under OSX that correctly installs both PATH and exec-path .

 ;;; Set localized PATH for OS X (defun my-add-path (path-element) "Add the specified PATH-ELEMENT to the Emacs PATH." (interactive "DEnter directory to be added to path: ") (if (file-directory-p path-element) (progn (setenv "PATH" (concat (expand-file-name path-element) path-separator (getenv "PATH"))) (add-to-list 'exec-path (expand-file-name path-element))))) (if (fboundp 'my-add-path) (let ((my-paths (list "/opt/local/bin" "/usr/local/bin" "/usr/local/git/bin"))) (dolist (path-to-add my-paths (getenv "PATH")) (my-add-path path-to-add)))) 
+4
source

Emacs on OS X uses system-wide environment variables that can be overridden by creating the magic environment.plist XML file in the correct directory. The best solution is for Emacs to copy the $PATH value from your shell so that it matches what you see in Terminal.app .

Answer to

@Anupam is based on a piece of code that I originally wrote for this purpose, but now I have improved this code and published it as a bit of an elisp library called exec-path-from-shell , which you can install from Marmalade or Melpa .

+2
source

Source: https://habr.com/ru/post/1433874/


All Articles