Macos -bash:gcc:未找到命令-Mavericks

Macos -bash:gcc:未找到命令-Mavericks,macos,gcc,homebrew,osx-mavericks,Macos,Gcc,Homebrew,Osx Mavericks,我已经安装了 Xcode 5 命令行工具 gcc与自制 但当我尝试使用gcc命令时,它会说: -bash: gcc: command not found 地点 gcc -version -bash: gcc: command not found bolo:~ Michelin$ ls /usr/bin/gcc-4.2 /usr/bin/gcc-4. 更新 bolo:~ Michelin$ xcode-select -p Usage: xcode-select -print-path

我已经安装了

  • Xcode 5
  • 命令行工具
  • gcc与自制
但当我尝试使用gcc命令时,它会说:

-bash: gcc: command not found
地点

gcc -version -bash: gcc: command not found 
bolo:~ Michelin$ ls /usr/bin/gcc-4.2 /usr/bin/gcc-4. 

更新

bolo:~ Michelin$ xcode-select -p
Usage: xcode-select -print-path
   or: xcode-select -switch <xcode_folder_path>
   or: xcode-select -version
Arguments:
   -print-path                     Prints the path of the current Xcode folder
   -switch <xcode_folder_path>     Sets the path for the current Xcode folder
   -version                        Prints xcode-select version information
bolo:~ Michelin$ xcode-select -print-path
/Applications/Xcode.app/Contents/Developer
更新(下午12:18)

在我的系统上

bolo:~ Michelin$ ls /usr/local/bin/gc
gcc-4.2   gcov-4.2  
我的bash_档案

export PATH=/usr/local/bin:$PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
source ~/.rvm/scripts/rvm
之后

bolo:~ Michelin$ echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/Michelin/.rvm/bin

谢谢

好的,问题解决了。我已经用另一个文件夹替换了我的bin文件夹,现在每个文件夹都工作了。

Maverick没有附带.bash\u配置文件。需要使用vim或nano命令更改bash_配置文件

编辑以下内容

# Set architecture flags
export ARCHFLAGS="-arch x86_64"
# Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:$PATH
# Load .bashrc if it exists
test -f ~/.bashrc && source ~/.bashrc

Xcode 5使用的是clang,而不是gcc。好的,我已经用hombrew安装了gcc,但是我仍然有一个命令找不到bolo:~Michelin$gcc-version-bash:gcc:command-not-found bolo:~Michelin$ls/usr/bin/gcc-4.2/usr/bin/gcc-4。如果找不到该命令,但您知道它存在于您的系统中,您需要修改shell的PATH环境变量以包括包含它的目录。我不确定您试图用
ls
命令传达什么——它的结果是什么?xcode选择-p和
定位'*/bin/gcc'
显示什么?@Kevin请在原始消息中查看我的更新。tks
# Set architecture flags
export ARCHFLAGS="-arch x86_64"
# Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:$PATH
# Load .bashrc if it exists
test -f ~/.bashrc && source ~/.bashrc