Subject: 23.2; Shell PATH environment variable problem

From: John McHugh <[email-masked]>
Date: Wed, 26 Jan 2011 16:34:51 -0500

From: John McHugh <[email-masked]>

This seems to be specific to OS X Leopard

I use bash as my emacs shell. I loaded 23.2.1 yesterday using
"homebrew", replacing an earlier version from macports which I
removed. along with a large number of applications.  I reinstalled TeX
from MacTeX-2010.  I noticed that tex programs were in the PATH in a
terminal shell, but not in an emacs shell.  Ultimately, I discovered
that the new TeX install had added a file with the path for TeX binaries
to /etc/paths.d/ and that none of the paths from these files were in the
PATH for the emacs shell but they were in the path for terminal shells.

As far as I can tell, emacs is obtaining the default PATH from
~/.MacOSX/environment.plist and then executing my .bashrc (or .profile
which is identical), but is not invoking the /etc/profile nor is it
calling "/usr/libexec/path_helper -s" which augments the defaults and is
called in /etc/profile.

My workaround is to create a .emacs_bash file which contains the line

eval `/usr/libexec/path_helper -s`

This provides the correct path at the minor expense of two command
prompts on the first line of the resulting shell buffer.

John McHugh

===========

In GNU Emacs 23.2.1 (x86_64-apple-darwin10.6.0, NS apple-appkit-1038.35)
 of 2011-01-25 on John-McHughs-MacBook-Pro.local
Windowing system distributor `Apple', version 10.3.1038
configured using `configure  '--prefix=/usr/local/Cellar/emacs/23.2' '--without-dbus' '--enable-locallisppath=/usr/local/share/emacs/site-lisp' '--infodir=/usr/local/Cellar/emacs/23.2/share/info/emacs' '--with-ns' '--disable-ns-self-contained' 'CC=/usr/bin/cc' 'CFLAGS=-O3 -w -pipe''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  shell-dirtrack-mode: t
  display-time-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<mouse-1> C-x b * s c r <tab> <return> M-v C-y <help-echo> 
<help-echo> <down-mouse-1> <mouse-1> <down-mouse-1> 
<mouse-1> M-x c o m p a r e SPC w SPC <return> <down-mouse-1> 
<mouse-1> <help-echo> <down-mouse-1> <mouse-1> C-x 
b p r <tab> <backspace> <backspace> . e m a <tab> <backspace> 
<backspace> <backspace> C-g g C-x C-r . e m a <tab> 
b <tab> <backspace> _ <tab> <return> <help-echo> <help-echo> 
<help-echo> <help-echo> <down-mouse-1> <mouse-movement> 
<mouse-movement> <drag-mouse-1> <down-mouse-1> <mouse-movement> 
<mouse-movement> <drag-mouse-1> <help-echo> <down-mouse-1> 
<mouse-1> C-y <return> e c h o SPC $ P A T H <return> 
<help-echo> <help-echo> <down-mouse-1> <mouse-1> C-x 
b <return> <down-mouse-1> <mouse-1> <help-echo> <down-mouse-1> 
<mouse-1> M-x c o m p a r e SPC w SPC <return> <help-echo> 
<help-echo> <down-mouse-1> <help-echo> <mouse-movement> 
<mouse-movement> <drag-mouse-1> <help-echo> <down-mouse-1> 
<mouse-1> C-x b <return> <up> <up> C-k C-x C-q C-a 
C-k C-k C-d C-x C-s <help-echo> C-o e c h o SPC f o 
o <down-mouse-1> <wheel-up> <drag-mouse-1> e c h o 
SPC b a r <return> C-x C-s <help-echo> <down-mouse-1> 
<mouse-1> C-x j C-x k <return> y e s <return> <backspace> 
M-x s h e k k <backspace> <backspace> l l <return> 
e c h o SPC $ P A T H <return> <help-echo> <down-mouse-1> 
<mouse-1> C-x b <return> <down-mouse-1> <mouse-1> <help-echo> 
<down-mouse-1> <mouse-1> M-x c o m p a r e SPC w SPC 
<return> <down-mouse-1> <mouse-1> C-x b <return> <up> 
<up> <up> C-k C-k <down> C-k C-k C-x C-s <down-mouse-1> 
<mouse-1> C-x k <return> y e s <return> M-x s h e l 
l <return> <return> e c h o SPC $ P A T H <return> 
<down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> C-x 
b <return> <up> <up> <up> M-x c o m p a r e SPC w SPC 
<return> <help-echo> M-x r e p o r t - e m <tab> <
return>

Recent messages:
Saving file /Users/mchugh/.emacs_bash...
Wrote /Users/mchugh/.emacs_bash
byte-code: Beginning of buffer
Mark set
Saving file /Users/mchugh/.emacs_bash...
Wrote /Users/mchugh/.emacs_bash
Mark set
Saving file /Users/mchugh/.emacs_bash...
Wrote /Users/mchugh/.emacs_bash
Mark set

Load-path shadows:
None found.

Features:
(shadow sort mail-extr message ecomplete rfc822 mml mml-sec
password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231
rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc
time-date mm-util mail-prsvr gmm-utils mailheader canlock sha1 hex-util
hashcash mail-utils emacsbug compare-w multi-isearch dired-aux dired
regexp-opt cus-edit wid-edit pp help-mode view apropos help-fns
ansi-color shell comint ring time cus-start cus-load tooltip ediff-hook
vc-hooks lisp-float-type mwheel ns-win easymenu tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev loaddefs button minibuffer faces cus-face files
text-properties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process ns
multi-tty emacs)