command line tools for OS X的安装

来源:互联网 发布:路边野餐 知乎 编辑:程序博客网 时间:2024/06/05 04:52

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就安装成功了。
0 0
原创粉丝点击