您的位置:首页 > 其它

command line tools for OS X的安装

2015-10-01 16:24 741 查看
1、打开终端,输入“xcode-select --install”;

2、在弹出的对话框中,未安装Xcode则点击对应图标进行Xcode的安装 若已安装,则点击对话框中的“安装”按钮进行command line tools的安装。

3、安装完毕,在终端命令行输入“gcc -v”进行安装验证测试。之后可能会跳出以下语句:

xcrun: error: active developer path ("/Users/fighter/Desktop/Xcode.app/Contents/Developer") does not exist, use `xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools
(or see `man xcode-select`)

以上大致意思是在当前的路径下找不到Xcode软件,要求修改Xcode的路径。具体办法:

xcode-select --switch +xcode.app的当前路径(依次打开Finder >>应用程序,用鼠标左键选中其中的Xcode.app图标拖到终端"xcode-select --switch "命令后即可。注意有空格)

4、按回车后终端跳出以下提示:

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.
To proceed, enter your password, or type Ctrl-C to abort.
Password:

我们在password处输入计算的管理密码(即登录密码),然后按回车确认;

5、

这时,我们可以在终端中输入gcc -v进行安装测试。出现提示语句:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

至此,我们的command line tools就安装成功了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  command xcode 终端 gcc 安装