Skip to content

Instantly share code, notes, and snippets.

@robdaemon
Created December 10, 2015 05:20
Show Gist options
  • Select an option

  • Save robdaemon/0ef7ea7614cfbce945bd to your computer and use it in GitHub Desktop.

Select an option

Save robdaemon/0ef7ea7614cfbce945bd to your computer and use it in GitHub Desktop.
Fix the path on emacs on Mac
;; fix the PATH variable
(defun set-exec-path-from-shell-PATH ()
(let ((path-from-shell (shell-command-to-string "$SHELL -i -c 'echo -n $PATH'")))
(setenv "PATH" path-from-shell)
(setq exec-path (split-string path-from-shell path-separator))))
(defun set-env-from-shell (envvar)
(let ((path-from-shell (shell-command-to-string (format "$SHELL -i -c 'echo -n $%s'" envvar))))
(setenv envvar path-from-shell)))
(if window-system
(progn
(set-exec-path-from-shell-PATH)
(set-env-from-shell "GOPATH")
(set-env-from-shell "GOROOT")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment