【问题标题】:-bash: gcc: command not found - Mavericks-bash:gcc:找不到命令 - 小牛队
【发布时间】:2013-11-23 15:17:39
【问题描述】:

我已经安装了

  • 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. 

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

谢谢

【问题讨论】:

  • 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-select -plocate '*/bin/gcc' 显示什么?
  • @Kevin 请在原始消息中查看我的更新。 tks

标签: macos gcc homebrew osx-mavericks


【解决方案1】:

好的,问题解决了。我已经用另一个替换了我的 bin 文件夹,现在一切正常。

【讨论】:

    【解决方案2】:

    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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-09
      • 1970-01-01
      相关资源
      最近更新 更多