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

Russell E. Owen rowen at uw.edu
Fri Apr 8 00:56:56 CEST 2011

In article <64461.1302209314 at parc.com>, Bill Janssen <janssen at parc.com> 

> 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.
> So I ran the installer, and tried a few things, and it didn't solve my
> buildbot problems.  So I decided to go back to the original System
> python.  But now I find that the installer has put the 2.7 Python on my
> PATH?!?  It does this apparently by hacking ~/.bash_profile.  In there,
> there's a line saying
>   The original version is saved in .bash_profile.pysave
> a file which doesn't seem to exist.
> 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?

I'm surprised you can't find it. I've always had it saved on some 
obvious place. But I agree that hacking the file is ugly -- it least it 
could ask.

In any case you can revert by just deleting the extra lines.

Other gripes about the installer:
- It names the version explicitly instead of using the Current symlink 
- It hacks the file even if doesn't need to (e.g. if Current is already 
on the $PATH then the new python will be found; I think that would be 
easy to check).
- It adds a bunch of links to /usr/local/bin even though that is 
redundant with putting Python's bin directory on the $PATH. This makes 
it a headache to switch Python versions -- something developers often 
need to do when testing compatibility.

That said, they're minor annoyances and I've not come forward to fix any 
of them. And the resulting python works nicely.

-- Russell

More information about the Pythonmac-SIG mailing list