From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Perry Smith Newsgroups: gmane.emacs.help Subject: Re: Emacs on Mac 10.7 (Lion): how to get PATH as in terminal? Date: Sun, 23 Oct 2011 16:17:53 -0500 Message-ID: References: <89B4BD3D-602B-4B69-961E-2567B30B916B@math.ethz.ch> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1319404692 13524 80.91.229.12 (23 Oct 2011 21:18:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 23 Oct 2011 21:18:12 +0000 (UTC) Cc: Emacs help To: Marius Hofert Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 23 23:18:08 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RI5Qm-0004cZ-0x for geh-help-gnu-emacs@m.gmane.org; Sun, 23 Oct 2011 23:18:08 +0200 Original-Received: from localhost ([::1]:39670 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RI5Ql-00011O-E2 for geh-help-gnu-emacs@m.gmane.org; Sun, 23 Oct 2011 17:18:07 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:40407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RI5Qe-00010h-UK for help-gnu-emacs@gnu.org; Sun, 23 Oct 2011 17:18:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RI5Qd-0007vA-1s for help-gnu-emacs@gnu.org; Sun, 23 Oct 2011 17:18:00 -0400 Original-Received: from mail-gx0-f169.google.com ([209.85.161.169]:33807) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RI5Qc-0007v3-TE for help-gnu-emacs@gnu.org; Sun, 23 Oct 2011 17:17:59 -0400 Original-Received: by ggnh4 with SMTP id h4so6097460ggn.0 for ; Sun, 23 Oct 2011 14:17:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=Nn/JCtErbrdrFitZ1tj2gLaCsZ+Q1u8rbrOsIpYSR+U=; b=ay19bwChrba/GtiWl2uS9JFPRw7Xnuir/uk499tjwTDNJbVno1vadRu/CXmIT6IY6C CgZNptchr36p4KbZ8cnXqOJbSYljr87JutmwamOOaVY77pgy5T3ZtwMfEYfkFchywh7S x4CFESjwA8eMUYDxrw5mqzmNiHabh5o7m7x0Q= Original-Received: by 10.236.156.71 with SMTP id l47mr5742723yhk.130.1319404677372; Sun, 23 Oct 2011 14:17:57 -0700 (PDT) Original-Received: from [10.0.0.4] ([64.128.19.234]) by mx.google.com with ESMTPS id y71sm503760yhh.6.2011.10.23.14.17.55 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 23 Oct 2011 14:17:56 -0700 (PDT) In-Reply-To: <89B4BD3D-602B-4B69-961E-2567B30B916B@math.ethz.ch> X-Mailer: Apple Mail (2.1251.1) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:82627 Archived-At: On Oct 23, 2011, at 3:58 PM, Marius Hofert wrote: > Hi, >=20 > 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 >=20 > Question: How do I get the same PATH in emacs than in the terminal? >=20 > Trials: >=20 > 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) >=20 > 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") >=20 > 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"))) I did not download the emacs that you did and dig around so I am sorta = half guessing. Recently while dinking with rvm, I discovered that bash is not being = started with --login. Since the M-x shell has fewer parts in its path, I would suspect that = the additional paths are being specified in /etc/profile. Without bash thinking it is = a login shell, /etc/profile is not being sourced. One way is to start it with a - as = the first character in arg0. The other way is to start it with --login. To explore if this is right: find where the parts for longer path are = being set. One choice is /etc/profile, another is your ~/.profile. If these parts are = in the profile but not in your .bashrc, then we are likely on the right track. If that is the case, then review explicit-bash-args. You can customize = them and add --login see if that works. I'm a bit surprised this isn't done in the stock = version of the code. If you have a .profile,.bash_profile, or .bashrc, you can echo the path at the very top of each and open a new = term window. This will tell you where / how PATH is being set as it goes through your sequence = of login scripts. Hope this helps, pedz