How do I resolve -bash: .bash_profile.pysave: command not found error in the Terminal?

My computer has been doing fairly okay but recently I have been getting the following error: ( -bash: .bash_profile.pysave: command not found ) four times each and every time I open up the Terminal. This can't be good, so I was wondering how I might be able to fix it.

MacBook Pro, Mac OS X (10.7)

Posted on May 22, 2012 8:49 AM

Reply
14 replies

May 22, 2012 2:25 PM in response to BobHarris

Your alternative worked. Here's what it output:


/Users/me/.bash_profile:.bash_profile.pysave

/Users/me/.bash_profile:.bash_profile.pysave

/Users/me/.bash_profile:.bash_profile.pysave

/Users/me/.bash_profile:.bash_profile.pysave

/Users/me/.bash_profile.pysave:.bash_profile.pysave

/Users/me/.bash_profile.pysave:.bash_profile.pysave

/Users/me/.bash_profile.pysave:.bash_profile.pysave

/Users/me/.bash_profile.pysave:.bash_profile.pysave

May 23, 2012 5:30 AM in response to MammonMachine

You can use the command


cat .bash_profile


to see what's in the file.


Save a copy:


cp .bash_profile .bash_profile_save


Then edit the file:


nano .bash_profile


And find and correct the error.


If you're not familiar with bash, post up the contents of the file from the cat and we'll have a look at it.


Has an add-on Python kit been installed here?


Thanks for the correction, Bob; my bad. Been using a VMS box - which interprets that wildcard character differently - this week.

May 23, 2012 5:50 AM in response to MrHoffman

Thanks for the correction, Bob; my bad. Been using a VMS box - which interprets that wildcard character differently - this week.

Not a problem. I have 13 years of VMS experience as both a System Administrator (outside of DEC) as well as a PATHWORK developer (inside of DEC). I didn't always live on the ZK3 3rd floor :-)


MammonMachine,


Based on your grep output, I looks like your .bash_profile has several lines of:


.bash_profile.pysave


which bash will then try to lookup as a command via the directories listed in the PATH environment variable, and is not finding it.


HOWEVER, I suspect that it should really look like


. .bash_profile.pysave


or


source .bash_profile.pysave


The other problem is that there appears to be 4 copies of the .bash_profile.pysave in .bash_profile


I suspect you only need 1.


I am GUESSING here, as the grep of .bash_profile.pysave also shows lines of .bash_profile.pysave (self referencing).


AND if you get .bash_profile to source .bash_profile.pysave, then you are just going to get the same kinds of errors when .bash_profile.pysave is invoked for the same reasons.


So that raises the question of what the heck is in .bash_profile.pysave and should it be invoked during login at all.

May 23, 2012 6:47 AM in response to BobHarris

It sounds to me like something has gone wrong somewhere...


.bash_profile.pysave is created when you manually install Python (eg, you need Python 3.2); it is the backup of the old .bash_profile that is made by the install script before the script adds the new Python PATH info.


The only references to .bash_profile.pysave that should exist now in .bash_profile are one or more comment lines of the form "# The orginal version is saved in .bash_profile.pysave" indicating where the additions were made.

May 23, 2012 8:35 AM in response to MrHoffman

Yes, as some people have wondered, I did try installing a few versions of python on my computer—I was curious about programming (I'm a games writer) and wanted to learn through practice. I had problems with the installation and was confused about what exactly to install, which has probably resulted in the current situation. I'm not familiar with bash either, but here's what my profile looks like:



# Setting PATH for Python 2.7

# The orginal version is saved in me.bash_profile.pysave

PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"

export PATH



# Setting PATH for Python 3.1

# The orginal version is saved in me.bash_profile.pysave

PATH="/Library/Frameworks/Python.framework/Versions/3.1/bin:${PATH}"

export PATH



# Setting PATH for Python 3.1

# The orginal version is saved in me.bash_profile.pysave

PATH="/Library/Frameworks/Python.framework/Versions/3.1/bin:${PATH}"

export PATH



# Setting PATH for Python 3.2

# The orginal version is saved in me.bash_profile.pysave

PATH="/Library/Frameworks/Python.framework/Versions/3.2/bin:${PATH}"

export PATH

May 23, 2012 6:56 PM in response to MammonMachine

Something's not right. The output of the grep command you show does not match the contents of the file you listed.


That is if you grep for pysave on the file contents you showed the output of grep should have been:


/Users/me/.bash_profile:# The original version is saved in me.bash_profile.pysave


not


/Users/me/.bash_profile:.bash_profile.pysave


that is the whole line that the pysave was found on should have been printed.


In your post you wrote here's what my profile looks like: what profile are you refering to?


You need to cut and paste your entire .bash_profile here, which is where the grep command said it found

.bash_profile.pysave


regards

May 23, 2012 7:07 PM in response to MammonMachine

Please read through this thread: https://discussions.apple.com/thread/2261430?start=0&tstart=0


You probably want just one PATH environment variable in your .bash_profile (that's the colon-seperated list of directories where bash looks for commands and scripts to execute), and with one matching export command. (But I don't immediately see what's causing that output diagnostics message reported during your Terminal.app logins; the only references to that pysave stuff are commented out.)


Here's an (untested) updated file, for the most current version of Python:


#!/bin/bash

PATH="/Library/Frameworks/Python.framework/Versions/3.2/bin:${PATH}"

export PATH



To switch Python versions, you'll probably want to use a separate shell script to select the target Python version, and not try to load everything in your .bash_profile. (That current file has 3.2 and 3.1 and 3.1 and 2.7 all in the PATH (because of that ${{PATH} substitution in each), which means only the 3.1 stuff will usually be found.)


Resources for learning about bash are available:


http://tldp.org/LDP/Bash-Beginners-Guide/Bash-Beginners-Guide.pdf

http://tldp.org/LDP/abs/abs-guide.pdf

http://manuals.info.apple.com/en_US/IntroCommandLine_v10.6.pdf

May 28, 2012 7:32 AM in response to MammonMachine

In short, what we need to see here (and what's generating the messages at login) is the actual, real, "live" .bash_profile file.


In far more detail... The .bash_profile.pysave file is a locally-named, locally-created, locally-maintained file, and a file can be freely deleted with no untoward effects to your environment. (Well, technically, some script within some part of a Python un-install procedure might get cranky if this file is missing.)


This .bash_profile.pysave file is created as a backup for the edits that are being made to the actual, real, "live" .bash_profile file - a way to restore the original profile when/if something goes wrong. (Which also means that there's either another .bash_profile.pysave copy stashed somewhere, or only one Python uninstall sequence will ever work right when this file is restored to the "live" filename. Without additional stashed copies of this file, the previous edits are lost each time the .bash_profile gets updated; you get one saved copy. Worse, restoring the file means that any other changes made to your "live" .bash_profile file are lost. But that's another discussion.


Accordingly (and not having looked at whatever Python kit(s) you're working with), I'd assume that this is just a junk file. This because actually using this .bash_profile.pysave file during a deinstallation/remove/deinstall/deletion would clobber any other subsequent changes you've made to your profile. But then this also means you'll have to manually resolve the PATH stuff, and that's basically what I describe in my earlier reply, and that happens in the "live" .bash_profile file and not in this .bash_profile.pysave file.

May 28, 2012 8:23 AM in response to Frank Caggiano

I don't know how else to put this; the file I posted was also the contents of my .bash_profile file. It has the same contents as my .bash_profile_pysave. (that may be the source of the problem?)


Regardless, I changed the contents of .bash_profile to MrHoffman's suggestion of

#!/bin/bash

PATH="/Library/Frameworks/Python.framework/Versions/3.2/bin:${PATH}"

export PATH


And now I'm no longer getting those errors when I start the terminal. Did I do it right?

May 28, 2012 11:08 AM in response to MammonMachine

Ah; OK; confusion over your particular intent with "The profile is .bash_profile.pysave , and I've copied the entire contents of the file here." comment. That's NOT what gets executed, as was mentioned.


But it does look like the kit has been reinstalled several times, and has gone off the rails. Or there are manual set-up steps that were not followed when subsequent kits for different versions were installed.


But if you're gaining access to Python 3.2 as would be expected, then you're good to go.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do I resolve -bash: .bash_profile.pysave: command not found error in the Terminal?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.