{"id":6618,"date":"2017-05-26T10:06:56","date_gmt":"2017-05-26T17:06:56","guid":{"rendered":"http:\/\/www.yuleshow.com\/?p=6618"},"modified":"2017-05-26T10:06:56","modified_gmt":"2017-05-26T17:06:56","slug":"6618","status":"publish","type":"post","link":"https:\/\/www.yuleshow.com\/?p=6618","title":{"rendered":"Let emacs inherit the shell environment variables"},"content":{"rendered":"<p>After <a href=\"https:\/\/www.yuleshow.com\/?p=6616\">clean up the python on MacOS<\/a>, it still doesn&#8217;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&#8217;t have updated and new installed modules.<br \/>\nI found that emacs doesn&#8217;t use the MacOS system environment variables, then easy:<br \/>\n1. Go to the directory ~\/.emacs.d\/site-lisp under terminal<br \/>\n2. Get $PATH by shell<\/p>\n<pre>git clone https:\/\/github.com\/purcell\/exec-path-from-shell.git<\/pre>\n<p>3. Add the following to .emacs<\/p>\n<pre>(add-to-list 'load-path \"~\/.emacs.d\/site-lisp\/exec-path-from-shell\")\n(require 'exec-path-from-shell)\n(defconst *is-a-mac* (eq system-type 'darwin))  ;; test for amc\n(if *is-a-mac*\n    (add-hook 'after-init-hook 'exec-path-from-shell-initialize))<\/pre>\n<p>(reference: https:\/\/emacs.stackexchange.com\/questions\/17249\/how-to-make-terminal-shell-spawned-inside-emacs-running-on-a-mac-inherit-the-env)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After clean up the python on MacOS, it still doesn&#8217;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&#8217;t have updated and new installed modules. I found that emacs doesn&#8217;t use the MacOS system environment variables, then easy: 1. Go to the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[34,44],"tags":[],"class_list":["post-6618","post","type-post","status-publish","format-standard","hentry","category-emacs","category-mac-ios"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=\/wp\/v2\/posts\/6618","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6618"}],"version-history":[{"count":0,"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=\/wp\/v2\/posts\/6618\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6618"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6618"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}