From unknown Mon Aug 18 11:05:39 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#7923 <7923@debbugs.gnu.org> To: bug#7923 <7923@debbugs.gnu.org> Subject: Status: 23.2; Shell PATH environment variable problem Reply-To: bug#7923 <7923@debbugs.gnu.org> Date: Mon, 18 Aug 2025 18:05:39 +0000 retitle 7923 23.2; Shell PATH environment variable problem reassign 7923 emacs submitter 7923 John McHugh severity 7923 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 26 16:29:29 2011 Received: (at submit) by debbugs.gnu.org; 26 Jan 2011 21:29:30 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PiCve-0008E0-M1 for submit@debbugs.gnu.org; Wed, 26 Jan 2011 16:29:27 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PiCtP-00089W-C8 for submit@debbugs.gnu.org; Wed, 26 Jan 2011 16:27:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PiD1G-0007NJ-7x for submit@debbugs.gnu.org; Wed, 26 Jan 2011 16:35:15 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:41245) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PiD1G-0007NF-5E for submit@debbugs.gnu.org; Wed, 26 Jan 2011 16:35:14 -0500 Received: from [140.186.70.92] (port=38711 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiD1E-0000zP-VZ for bug-gnu-emacs@gnu.org; Wed, 26 Jan 2011 16:35:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PiD1D-0007N3-H0 for bug-gnu-emacs@gnu.org; Wed, 26 Jan 2011 16:35:12 -0500 Received: from fafnir.cs.unc.edu ([152.2.129.90]:41395) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PiD1D-0007MR-B6 for bug-gnu-emacs@gnu.org; Wed, 26 Jan 2011 16:35:11 -0500 Received: from [69.22.144.223] ([69.22.144.223]) (authenticated bits=0) by fafnir.cs.unc.edu (8.14.3/8.14.3) with ESMTP id p0QLYvvX028083 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Wed, 26 Jan 2011 16:35:02 -0500 From: John McHugh Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: 23.2; Shell PATH environment variable problem Date: Wed, 26 Jan 2011 16:34:51 -0500 Message-Id: <41BA395F-882C-4220-8783-DD0835920415@cs.unc.edu> To: bug-gnu-emacs@gnu.org Mime-Version: 1.0 (Apple Message framework v1082) X-Mailer: Apple Mail (2.1082) X-Scanned-By: MIMEDefang 2.71 on 152.2.129.90 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 26 Jan 2011 16:29:25 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) From: John McHugh 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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=3D/usr/local/Cellar/emacs/23.2' = '--without-dbus' = '--enable-locallisppath=3D/usr/local/share/emacs/site-lisp' = '--infodir=3D/usr/local/Cellar/emacs/23.2/share/info/emacs' '--with-ns' = '--disable-ns-self-contained' 'CC=3D/usr/bin/cc' 'CFLAGS=3D-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: C-x b * s c r M-v C-y =20 =20 M-x c o m p a r e SPC w SPC =20 C-x=20 b p r . e m a =20 C-g g C-x C-r . e m a =20 b _ =20 =20 =20 =20 C-y e c h o SPC $ P A T H =20 C-x=20 b =20 M-x c o m p a r e SPC w SPC =20 =20 =20 C-x b C-k C-x C-q C-a=20 C-k C-k C-d C-x C-s C-o e c h o SPC f o=20 o e c h o=20 SPC b a r C-x C-s =20 C-x j C-x k y e s =20 M-x s h e k k l l =20 e c h o SPC $ P A T H =20 C-x b =20 M-x c o m p a r e SPC w SPC=20 C-x b =20 C-k C-k C-k C-k C-x C-s =20 C-x k y e s M-x s h e l=20 l e c h o SPC $ P A T H =20 C-x=20 b M-x c o m p a r e SPC w SPC=20 M-x r e p o r t - e m < 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) From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 26 23:02:33 2011 Received: (at 7923) by debbugs.gnu.org; 27 Jan 2011 04:02:34 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PiJ45-0000dC-Na for submit@debbugs.gnu.org; Wed, 26 Jan 2011 23:02:33 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PiJ44-0000d3-KA for 7923@debbugs.gnu.org; Wed, 26 Jan 2011 23:02:33 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAJt/QE1MCo4O/2dsb2JhbACke3S7doMCEAGCPASFGI9wgzY X-IronPort-AV: E=Sophos;i="4.60,384,1291611600"; d="scan'208";a="89379352" Received: from 76-10-142-14.dsl.teksavvy.com (HELO ceviche.home) ([76.10.142.14]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 26 Jan 2011 23:10:29 -0500 Received: by ceviche.home (Postfix, from userid 20848) id A1802660DC; Wed, 26 Jan 2011 23:10:29 -0500 (EST) From: Stefan Monnier To: John McHugh Subject: Re: bug#7923: 23.2; Shell PATH environment variable problem Message-ID: References: <41BA395F-882C-4220-8783-DD0835920415@cs.unc.edu> Date: Wed, 26 Jan 2011 23:10:29 -0500 In-Reply-To: <41BA395F-882C-4220-8783-DD0835920415@cs.unc.edu> (John McHugh's message of "Wed, 26 Jan 2011 16:34:51 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 7923 Cc: 7923@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) > 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 From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 27 17:25:44 2011 Received: (at 7923) by debbugs.gnu.org; 27 Jan 2011 22:25:44 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PiaHg-0000J1-Kg for submit@debbugs.gnu.org; Thu, 27 Jan 2011 17:25:44 -0500 Received: from fafnir.cs.unc.edu ([152.2.129.90]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PiaHf-0000Io-7V for 7923@debbugs.gnu.org; Thu, 27 Jan 2011 17:25:43 -0500 Received: from [69.22.144.226] ([69.22.144.226]) (authenticated bits=0) by fafnir.cs.unc.edu (8.14.3/8.14.3) with ESMTP id p0RMXk8Y031450 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Thu, 27 Jan 2011 17:33:52 -0500 Subject: Re: bug#7923: 23.2; Shell PATH environment variable problem Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: John McHugh In-Reply-To: Date: Thu, 27 Jan 2011 17:33:41 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: References: <41BA395F-882C-4220-8783-DD0835920415@cs.unc.edu> To: Stefan Monnier X-Mailer: Apple Mail (2.1082) X-Scanned-By: MIMEDefang 2.71 on 152.2.129.90 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: 7923 Cc: 7923@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.7 (---) 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 =20 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=20 /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 From debbugs-submit-bounces@debbugs.gnu.org Tue May 24 14:37:14 2016 Received: (at 7923-done) by debbugs.gnu.org; 24 May 2016 18:37:14 +0000 Received: from localhost ([127.0.0.1]:36745 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5HCb-0004lq-QF for submit@debbugs.gnu.org; Tue, 24 May 2016 14:37:14 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:36565) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5HCa-0004ld-4A for 7923-done@debbugs.gnu.org; Tue, 24 May 2016 14:37:12 -0400 Received: by mail-wm0-f54.google.com with SMTP id n129so144895705wmn.1 for <7923-done@debbugs.gnu.org>; Tue, 24 May 2016 11:37:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=CbQuTbLf7lfzLaVSy2oUla5Wj4Y/QW4AMvjBiNNHDwk=; b=NDOdtqpTxcKOLCyrx26M3FxVxCrNxNk7Qya//zhU93YVVGP7SAvY8pWkv0NAMpwXVi 0C1uLkUD/d6KDwLhwV3fP7n/Mpo53pM02hRfM7KHfSJ2hz8bk6nKcOV4xVO5n6yewHiw 61XTYHiTHgnHPJEdDumK2f4p/51BbQveO9Jjg0mVq7VXjdcYR+SljgmSelYFD360jEZS EAF+blsdaBCBg44sm7CuXGKFXlrRTCyfSlcIany5mzniQjQmiclj2YIPNbbSSnVVd6IN PFnyPUHDDX8f1w3g97jLE/FeWKBnvDzLD8xEeItG2twdRaArmGM2a/fdrtPr1rLDSPWe kS2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=CbQuTbLf7lfzLaVSy2oUla5Wj4Y/QW4AMvjBiNNHDwk=; b=OMqonSwqhRxhEjovnNs9ldaGMeBOU+Mrj/z2WiZFvndaKrabWAvnTIoYho4sHoOvJk 2XzkYBvYppjnVq76R44IBqRLkSiKsMOtaFQhYdb1wNEL969BgtgPMVVW3bfZRtEgqvAY vOQllwXzdPc7JPTT/ayMZdKXSkTgLFku44QMEa2oO8UPHLgrLMGv9zJXtWx4sH/R2Gd1 c4JrIKCGtDftsh2heSTix7R1qX6qWeD93DPpJSh8Dq5/Ftg+bZo9FGGjRJX2jWVCR8wj jLRNOkFBR07bAIIgVTYCW32Xs0d1kKbeM4PmITgQsjaIadrInv2ktin5TGUck0GHsCyD LRXg== X-Gm-Message-State: ALyK8tLSf4TVuzFHgHgAwMWQXyi2iss6rfeSf+WT1nr9zwPLD7qo7JXeJChZozHsB9OmDA== X-Received: by 10.28.132.68 with SMTP id g65mr209629wmd.91.1464115026366; Tue, 24 May 2016 11:37:06 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-7175-fea4-ded1-da32.holly.idiocy.org. [2001:8b0:3f8:8129:7175:fea4:ded1:da32]) by smtp.gmail.com with ESMTPSA id g3sm4567931wjb.47.2016.05.24.11.37.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 May 2016 11:37:05 -0700 (PDT) From: Alan Third To: John McHugh Subject: Re: bug#7923: 23.2; Shell PATH environment variable problem References: <41BA395F-882C-4220-8783-DD0835920415@cs.unc.edu> Date: Tue, 24 May 2016 19:36:59 +0100 In-Reply-To: (John McHugh's message of "Thu, 27 Jan 2011 17:33:41 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (darwin) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 7923-done Cc: Stefan Monnier , 7923-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) John McHugh 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 From unknown Mon Aug 18 11:05:39 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 22 Jun 2016 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator