emacs MAC/iOS

Let emacs inherit the shell environment variables

After clean up the python on MacOS, it still doesn’t work well in emacs. I found emacs still called the wrong python. My shell load 2.7.13 and emacs used 2.7.10, which doesn’t have updated and new installed modules.
I found that emacs doesn’t use the MacOS system environment variables, then easy:
1. Go to the directory ~/.emacs.d/site-lisp under terminal
2. Get $PATH by shell

git clone https://github.com/purcell/exec-path-from-shell.git

3. Add the following to .emacs

(add-to-list 'load-path "~/.emacs.d/site-lisp/exec-path-from-shell")
(require 'exec-path-from-shell)
(defconst *is-a-mac* (eq system-type 'darwin))  ;; test for amc
(if *is-a-mac*
    (add-hook 'after-init-hook 'exec-path-from-shell-initialize))

(reference: https://emacs.stackexchange.com/questions/17249/how-to-make-terminal-shell-spawned-inside-emacs-running-on-a-mac-inherit-the-env)

Leave a Reply

Your email address will not be published. Required fields are marked *