From: Jim Crossley <jcrossley@redhat.com>
To: help-gnu-emacs@gnu.org
Subject: Re: inherit the path environment from .bash_profile (Mac OS 10.5)
Date: Fri, 06 Aug 2010 10:00:13 -0400 [thread overview]
Message-ID: <m2bp9flu36.fsf@jimbook.crossleys.home> (raw)
In-Reply-To: AANLkTikOyAc2ix_BZ6+9M2q2=USs7SrqdSST+SXTEkr9@mail.gmail.com
Hi Z,
Z <zell08v@orange.fr> writes:
> Is there a way to inherit the path environments of .bash_profile, when
> we lance emacs directly from the dock of Macs?
I looked long and hard for a good way of doing this, so that both GUI
and CLI apps had the same environment (path+vars), no matter how they
were started, e.g. spotlight, dock, bash, etc.
I'm sorry to report there is NO GOOD WAY to do it on a Mac. Here's what
I ultimately ended up adding to my Emacs config:
;; Setup PATH
(setenv "PATH" (shell-command-to-string "source ~/.bashrc; echo -n $PATH"))
;; Update exec-path with the contents of $PATH
(loop for path in (split-string (getenv "PATH") ":") do
(add-to-list 'exec-path path))
The above answers your question specifically about PATH. I'll add this
bit about vars, too, since you'll eventually want it. :)
;; Grab other environment variables
(loop for var in (split-string (shell-command-to-string "source ~/.bashrc; env")) do
(let* ((pair (split-string var "="))
(key (car pair))
(value (cadr pair)))
(unless (getenv key)
(setenv key value))))
I symlink my ~/.bashrc to ~/.bash_profile, btw.
Good luck,
Jim
>
> In fact, I am using Mac OS X 10.5. I launch carbon emacs from the dock (which
> is the icons list normally at the bottom of the screen) . Then, if I invoke a
> shell from within emacs, it does not inherit the path environment defined at
> .bash_profile !
>
> So in my case, how can I achieve this inheritance of path environments? Maybe
> it suffices to add something at the initialization file .emacs?
>
> Thank you for your ideas.
>
> Z.
>
>
next prev parent reply other threads:[~2010-08-06 14:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-06 3:15 inherit the path environment from .bash_profile (Mac OS 10.5) Z
2010-08-06 14:00 ` Jim Crossley [this message]
2010-08-06 15:36 ` Peter Dyballa
-- strict thread matches above, loose matches on Subject: below --
2010-08-06 3:17 Inherit " Z
2010-08-06 8:47 ` Peter Dyballa
2010-08-06 14:04 ` Jim Crossley
2010-08-06 15:27 ` Peter Dyballa
2010-08-08 17:54 ` Andrea Crotti
2010-08-06 12:09 ` Andrea Crotti
[not found] <mailman.0.1281064508.32647.help-gnu-emacs@gnu.org>
2010-08-06 5:58 ` inherit " Tim X
2010-08-06 7:15 ` Xah Lee
[not found] <mailman.1.1281064641.32647.help-gnu-emacs@gnu.org>
2010-08-06 12:02 ` Inherit " Elena
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2bp9flu36.fsf@jimbook.crossleys.home \
--to=jcrossley@redhat.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.