我在 OS X 10.6.8 上使用 Emacs 24。做 magit-status



但是,Emacs shell 能够找到 git ,所以这似乎不是 $PATH 问题。还能是什么?

最佳答案

尝试检查 exec-path 变量的值。这控制了 Emacs 为外部可执行文件(包括 git)查找的目录。

这是一个可自定义的变量,您可以将 git 的路径添加到现有目录列表中。

我的 .emacs.d/init.el 文件中有 elisp 片段,用于在 OSX 下安装 Emacs,它正确设置了 PATHexec-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))))

关于macos - 找不到 git 可执行文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12394381/

10-12 07:34
查看更多