[OS X Emacs] How to configure '~/.bash_profile' and '~/.bashrc' to work with Aquamacs?
Christopher M. Balz
christopherbalz at yahoo.com
Fri Jul 8 15:44:54 EDT 2011
Thank you Peter. I made two changes that seem to do the trick (I had earlier done Aquamacs -> Tools -> Install Command Line Tools). The changes were: a) Remove the '~/.emacs_bash' symlink I'd created; b) Create a '~/.bashrc' file containing an invocation of my alias-setting script; c) Invoke '~/.bashrc' from '~/.bash_profile' (leaving exported env vars in ~/'.bash_profile' where they belong).
Aquamacs seems to append '/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin' to the path it gets from '~/.bash_profile', but that doesn't seem to be a problem.
----- Original Message -----
From: Peter Dyballa <Peter_Dyballa at Web.DE>
To: Christopher M. Balz <christopherbalz at yahoo.com>; Emacs on Mac OS X Mailing List <macosx-emacs at email.esm.psu.edu>
Sent: Friday, July 8, 2011 1:32 AM
Subject: Re: [OS X Emacs] How to configure '~/.bash_profile' and '~/.bashrc' to work with Aquamacs?
Am 08.07.2011 um 02:35 schrieb Christopher M. Balz:
> However, what is needed is to configure Aquamacs so that '~/.bash_profile' executes once per Aquamacs session, and '~/.bashrc' executes once per Aquamacs shell? Otherwise, for example with a link from '~/.emacs_bash' to '~/.bash_profile', concatenated shell variables (commonly, $PATH) get a lot of redundant values in them.
> On *nix and Cygwin-on-NT, GNU Emacs works out of the box with '.bash_profile' and '.bashrc' in the expected way: '.bash_profile' is executed once on the *nix system, and all shells, including Emacs shell buffers, get the variables from that. Likewise, '.bashrc' executes once per *nix shell, including for Emacs shell buffers.
The difference of Mac OS X is that it launches processes *without* a shell's aid. So you need to wrap a shell (script) around the launching of Aquamacs Emacs. Or you launch it from a command line (open ...). Another way is to use ~/.MacOSX/environment.plist, documented in /Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html or http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html.
The file ~/.emacs_bash is executed when inside any Emacs a(n interactive) shell is started, by this shell instance. You can insert those statements that perform or set up something particular for Emacs.
There is no worse tyranny than to force a man to pay for what he does not want merely because you think it would be good for him.
– Robert Heinlein
More information about the MacOSX-Emacs