terminal -bash: command not found I'm trying to compile a c++ program on the Mac terminal with gcc then the source files path. I've found some short term fixes on the Internet but I want it so it works every time. Also I hardly know anything about the Terminal so can the solution be explained very simply. 

echo $PATH gives:

/Library/Frameworks/Python.framework/Versions/2.7/bin:’/usr/local/bin:??


/bin/cat ~/.profile prints no such file or directory,

/bin/cat ~/.bash_profile prints: 

export PATH=’/usr/local/bin:?? 
# 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


When I use gcc to compile the program I get "-bash: gcc: command not found"

However if I run the commands

export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"


…the terminal works. I'd like to know how to make it work without running those commands.
Modify the file .bash_profile with nano or another appropriate editor:

Replace:

export PATH=’/usr/local/bin:?? 
# 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 


by:

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
export PATH=/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH




Explanation:

The first line of your current .bash_profile 

export PATH=’/usr/local/bin:?? 


modifies the standard value of $PATH given by /etc/paths from

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin 


to ’/usr/local/bin:?? - which is no valid path. 

The fourth and fifth line of your current .bash_profile modifies $PATH to 

/Library/Frameworks/Python.framework/Versions/2.7/bin:’/usr/local/bin:??


Since ’/usr/local/bin:? is no valid path the finally effective PATH is 

/Library/Frameworks/Python.framework/Versions/2.7/bin


which completely breaks your standard PATH. You can still execute all executables in the above directories but you can't omit the superior directories (e.g. to execute nano you have to enter /usr/bin/nano instead of nano).