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.
gcc
at/usr/bin/gcc
. I do not think you can executegcc
until you install Xcode. Your post does not actually ask a question. So what is the exact problem you want solved?bash
, which error message do you get?export PATH
, but this won't help you if the PATH definition is wrong to start with. It also won't help you if your issue is not PATH related. So please help us help you in describing the problem you are facing with compiling C++ code, which things you've tried already and where you are stuck now.