[Pythonmac-SIG] why does the Mac installer hack the user's .bash_profile?

Bill Janssen janssen at parc.com
Fri Apr 8 02:03:21 CEST 2011

Ned Deily <nad at acm.org> wrote:

> In article <64461.1302209314 at parc.com>, Bill Janssen <janssen at parc.com> 
> wrote:
> > I've got a Snow Leopard buildslave I'm trying to debug.  So I thought
> > I'd try Python 2.7 on it.  Normally, I advise people to never try to
> > install a different Python on a Mac, as it's too embedded in the OS to
> > do safely, without a great deal of domain knowledge.  But here, I
> > figured I could always wipe the disk and start over without too much
> > loss.
> I don't understand why you would say that.

I think it's gotten immensely better over the years, thanks to the
efforts of folks like you and Ronald.  But I still think it tends to
have too many side-effects which surprise and confuse people.

> The huge advantage of the 
> Python framework installation layout on OS X is precisely that it 
> *doesn't* get embedded into the OS and *does* allow multiple versions of 
> Python to co-exist on a system far more easily and safely than with the 
> traditional Python Unix layout.  With a very few exceptions, all of the 
> files installed are under one root 
> (Library/Frameworks/Python.framework/Versions/m.n/) with some auxiliary 
> files under another (/Applications/Python m.n) and optionally some 
> symlinks in /usr/local/bin, with *zero* overlap with any Apple-supplied 
> files in OS X including the Apple-supplies Pythons.  If for some reason 
> you do want to uninstall a framework build, it's a matter of two 'rm' 
> commands and optionally removing some obvious symlinks in /usr/local/bin 
> (which are not needed in the first place).  An official uninstall 
> command would be nice to have and has been requested in the past (see 
> http://bugs.python.org/issue7107).

Yes, that would be nice.

> > So, why didn't I notice myself checking the checkbox to do this in the
> > first place, and where is my original .bash_profile file?
> The Python 2.7.1 installer welcome file, the text that is shown in the 
> first installer screen, says this:
> "This package will by default update your shell profile to ensure that 
> this version of Python is on the search path of your shell. Please 
> deselect the "Shell profile updater" package on the package 
> customization screen if you want to avoid this modification.  
> Double-click Update Shell Profile at any time to make 2.7.1 the default 
> Python."

So it's a default operation.

> (Earlier installers had slightly different wordings.)
> The command that does this is in /Applications/Python m.n/Update Shell 
> Profile.command.  Normally, it should have saved your .bash_profile as 
> ~/.bash_profile.pysave, but, even if it didn't, the only modification it 
> makes to your original .bash_profile is to append these (or similar) 
> lines to the end of the file:
> # Setting PATH for Python 2.7
> # The orginal version is saved in .bash_profile.pysave
> PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
> export PATH
> Hope that helps!

Yes, thanks, very complete explanation.  Like I said, I never run this
installer, so lack of familiarity on my part is most of the problem.

Though, I wouldn't have defaulted that path hacking to "On".  But I
understand the problem with the range of user knowledge you guys are
trying to cope with.


More information about the Pythonmac-SIG mailing list