[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Emacs on Mac 10.7 (Lion): how to get PATH as in terminal?
From: |
Marius Hofert |
Subject: |
Emacs on Mac 10.7 (Lion): how to get PATH as in terminal? |
Date: |
Sun, 23 Oct 2011 22:58:35 +0200 |
Hi,
I know this is an old problem, but I still couldn't figure it out with the
tricks I found.
I work with the emacs 23.3 on Mac OS X 10.7.2 (Lion), installed from
http://emacsformacosx.com/
When I open a shell with M-x shell and type echo $PATH, I get:
/usr/bin:/bin:/usr/sbin:/sbin
When I do the same in Mac's Terminal, I get:
/Applications/Emacs.app/Contents/MacOS/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin:/opt/local/bin:/opt/local/sbin
Question: How do I get the same PATH in emacs than in the terminal?
Trials:
1) fixpath.el:
(add-to-list 'load-path "~/.emacs.d/fixpath"); see
https://svn.fsg.ulaval.ca/svn-pub/vgoulet/emacs-modified/macos/tags/Emacs-23.3-modified-3/fixpath.el
(require 'fixpath)
2) emacs wiki (http://www.emacswiki.org/emacs/EmacsApp#toc2)
;; add "defaults..." to /etc/profile:
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
defaults write $HOME/.MacOSX/environment PATH "$PATH"
fi
;; add the following to .emacs:
(add-to-list 'exec-path "/usr/bin")
3) another solution posted on the emacs wiki page:
;; read in PATH from .bashrc (and add at least those directories)
;; see http://www.emacswiki.org/emacs/EmacsApp#toc5
(if (not (getenv "TERM_PROGRAM"))
(setenv "PATH"
(shell-command-to-string "source $HOME/.bashrc && printf $PATH")))
Cheers,
Marius
- Emacs on Mac 10.7 (Lion): how to get PATH as in terminal?,
Marius Hofert <=