all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#7923: 23.2; Shell PATH environment variable problem
@ 2011-01-26 21:34 John McHugh
  2011-01-27  4:10 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: John McHugh @ 2011-01-26 21:34 UTC (permalink / raw)
  To: 7923

From: John McHugh <mchugh@John-McHughs-MacBook-Pro.local>

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)






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#7923: 23.2; Shell PATH environment variable problem
  2011-01-26 21:34 bug#7923: 23.2; Shell PATH environment variable problem John McHugh
@ 2011-01-27  4:10 ` Stefan Monnier
  2011-01-27 22:33   ` John McHugh
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2011-01-27  4:10 UTC (permalink / raw)
  To: John McHugh; +Cc: 7923

> 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

IIUC the difference is because Terminal.app runs the shell as a login
shell (which is a somewhat unusual choice, for an old Unix guy), whereas
Emacs's M-x shell doesn't.

You can make your .bashrc to source /etc/profile.

Tho maybe your better choice will be to try and make Emacs's own PATH to
be set properly (i.e. have it run your path_helper somehow).


        Stefan





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#7923: 23.2; Shell PATH environment variable problem
  2011-01-27  4:10 ` Stefan Monnier
@ 2011-01-27 22:33   ` John McHugh
  2016-05-24 18:36     ` Alan Third
  0 siblings, 1 reply; 4+ messages in thread
From: John McHugh @ 2011-01-27 22:33 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 7923

Stefan

I don't think this is the problem

In OS X, Leopard, the initial $PATH setting comes from a property list file

~/.MacOSX/environment.plist  

This file contains a list of properties and their initial values.  In this case, the properties are environment variables.
The value for the PATH is 

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

According to the OS X Leopard documentation, the contents of files in /etc/paths.d is then added to PATH.  This allows software packages to add their specific bin directories without consideration of the specific shell to be used, or the user using the machine.  Installing X11 adds a file to this directory containing the path to X11 binaries.

Now, if I issue the emacs command "shell-command echo $PATH" I get the PATH value that is in the plist file.  If I change the plist file, output of that command changes, as well.

What is not happening is that the additional files in /etc/paths.d are not being added to the path.

Since my shell for shell windows in emacs is bash, my .bashrc file is being executed since, they appear in the PATH echoed from a shell window in emacs.

Is there an explanation of how emacs sets the path for shell commands?

John






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#7923: 23.2; Shell PATH environment variable problem
  2011-01-27 22:33   ` John McHugh
@ 2016-05-24 18:36     ` Alan Third
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Third @ 2016-05-24 18:36 UTC (permalink / raw)
  To: John McHugh; +Cc: Stefan Monnier, 7923-done

John McHugh <mchugh@cs.unc.edu> writes:

> Stefan
>
> I don't think this is the problem
>
> In OS X, Leopard, the initial $PATH setting comes from a property list file
>
> ~/.MacOSX/environment.plist  
>
> This file contains a list of properties and their initial values.  In this case, the properties are environment variables.
> The value for the PATH is 
>
> /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
>
> According to the OS X Leopard documentation, the contents of files in
> /etc/paths.d is then added to PATH. This allows software packages to
> add their specific bin directories without consideration of the
> specific shell to be used, or the user using the machine. Installing
> X11 adds a file to this directory containing the path to X11 binaries.
>
> Now, if I issue the emacs command "shell-command echo $PATH" I get the PATH value that is in the plist file.  If I change the plist file, output of that command changes, as well.
>
> What is not happening is that the additional files in /etc/paths.d are not being added to the path.
>
> Since my shell for shell windows in emacs is bash, my .bashrc file is being executed since, they appear in the PATH echoed from a shell window in emacs.
>
> Is there an explanation of how emacs sets the path for shell commands?

PATH handling on OS X is rather broken and seems to change with each new
release. GUI apps don't inherit the same PATH as terminal applications.
I've found the simplest solution for Emacs is to use the
exec-path-from-shell package.

I wrote up a wee bit about how zsh generates it's PATH on OS X, and it
may give you some pointers for bash:

http://unix.stackexchange.com/questions/246751/how-to-know-why-and-where-the-path-env-variable-is-set/250456#250456

Ultimately this isn't an Emacs problem, but a general issue with OS X,
so I'm going to close this bug report.

Sorry I can't be more help.

-- 
Alan Third





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-24 18:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-26 21:34 bug#7923: 23.2; Shell PATH environment variable problem John McHugh
2011-01-27  4:10 ` Stefan Monnier
2011-01-27 22:33   ` John McHugh
2016-05-24 18:36     ` Alan Third

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.