Setting the PATH variable from within EmacsPosted: August 10, 2009
A Small function to set the PATH variable from within Emacs. You can define the function and the path definitions in your .emacs file:
Very useful for OS X, where the default path is set by plists.
;; Define a function to setup additional path (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) (setenv "PATH" (concat (expand-file-name path-element) path-separator (getenv "PATH")))))
and use it as:
;;; Set localized PATH for OS X (if (fboundp 'my-add-path) (let ((my-paths (list "/opt/local/bin" "/usr/local/bin" "/usr/local/sbin" "/usr/local/mysql/bin" "~/bin"))) (dolist (path-to-add my-paths (getenv "PATH")) (my-add-path path-to-add))))