简体   繁体   English

在Mac上重新安装G ++

[英]Reinstall g++ on mac

I managed to nuke the g++ cc c++ gcc in my /usr/bin folder on my Mac running 10.9.1. 我设法在运行10.9.1的Mac上的/ usr / bin文件夹中对g ++ cc c ++ gcc进行了核对。 I've tried running brew install gcc-49, apple-gcc42 and downloading Xcode's Command Line tools. 我试过运行brew install gcc-49,apple-gcc42并下载Xcode的命令行工具。 All three haven't worked. 这三个都没有工作。 I've seen some sources say that gcc on OSX is just clang symlinked. 我已经看到一些消息说OSX上的gcc只是clang符号链接。

If so, are there similar symlinks to cc, g++ and c++ that I could use? 如果是这样,我可以使用与cc,g ++和c ++类似的符号链接吗? Even better, is there are way to just reset my system to whatever binaries I had initially? 更好的是,是否有办法将系统重置为最初的二进制文件?

On my Mac running OS X 10.9.1, I have: 在运行OS X 10.9.1的Mac上,我具有:

$ ls -l /usr/bin/gcc /usr/bin/g++ /usr/bin/clang
-rwxr-xr-x  1 root  wheel  14224 Oct 31 08:07 /usr/bin/clang
-rwxr-xr-x  1 root  wheel  14224 Oct 31 08:07 /usr/bin/g++
-rwxr-xr-x  1 root  wheel  14224 Oct 31 08:07 /usr/bin/gcc
$

However, despite appearances, the files are not identical: 但是,尽管出现了这些文件,但它们并不相同:

$ sha1 /usr/bin/gcc /usr/bin/g++ /usr/bin/clang
2a080c37c2a4c2ef8bd04b5a7a4f51901d0826a4 /usr/bin/gcc
d783a5c4fa9abd856f65e34afaca8bca1ded447b /usr/bin/g++
9bed37669a0b8c7f13f71662869a5d1a2f4f1c3b /usr/bin/clang
$

So, that route is not going to help…fortunately, I checked before suggesting that it would. 因此,该路线无济于事……很幸运,我在提出建议之前先进行了检查。

There is a separate XCode Command Line Tools download, which is what you need to reinstate (reinstall) the programs in /usr/bin . 有单独的XCode命令行工具下载,您需要恢复/重新安装/usr/bin的程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM