【发布时间】: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 -p和locate '*/bin/gcc'显示什么? -
@Kevin 请在原始消息中查看我的更新。 tks
标签: macos gcc homebrew osx-mavericks