-bash:gcc:命令未找到 - 小牛队

时间:2013-11-23 15:17:39

标签: macos gcc homebrew osx-mavericks

我已经安装了

  • Xcode 5
  • 命令行工具
  • gcc with homebrew

但是当我尝试使用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. 

http://cl.ly/image/3m2U1N0q1B2l

更新

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

bolo:~ Michelin$ locate */bin/gcc
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc
/Library/Developer/CommandLineTools/usr/bin/gcc
bolo:~ Michelin$ 

更新(下午12:18)

在我的系统上

bolo:~ Michelin$ ls /usr/local/bin/gc
gcc-4.2   gcov-4.2  

我的bash_profile

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

谢谢

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

Maverick并没有附带.bash_profile。需要使用vim或nano命令更改bash_profile。

使用以下编辑...

# 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