我在Macosx 10.9 Mavericks上安装了Xcode 5.0.1和命令行工具(例如我可以在命令行上使用gcc / clang),但命令opt
似乎已经消失了。
它被其他东西取代了吗?
答案 0 :(得分:9)
Apple从来没有在XCode命令行工具中发布'基础'LLVM工具,只有clang。您需要自己编译所需的LLVM修订版本。您也可以在http://llvm.org/releases/download.html下载预建的二进制文件。
答案 1 :(得分:8)
我的策略(小牛队)是brew install llvm
然后是符号链接:
sudo ln -s /usr/local/Cellar/llvm/3.4/bin/opt /usr/bin/opt
sudo ln -s /usr/local/Cellar/llvm/3.4/bin/llc /usr/bin/llc
答案 2 :(得分:3)
我通过Homebrew安装High Sierra,以便在High Sierra上工作。
brew install llvm
完成后,Homebrew会告诉你这样的事情:
To use the bundled libc++ please add the following LDFLAGS:
LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/llvm/lib
CPPFLAGS: -I/usr/local/opt/llvm/include
If you need Python to find bindings for this keg-only formula, run:
echo /usr/local/opt/llvm/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/llvm.pth
继续并运行:
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile
将其粘贴到.bashrc
/ .bash_profile
。
答案 3 :(得分:0)
我将为El Capitan和Sierra添加解决方案,因为它现在显示错误
ln: /usr/bin/opt: Operation not permitted
这很简单,只需转到~/.bash_source
(或你所拥有的任何shell的rc文件)并写下alias opt='/usr/local/Cellar/llvm/<llvm_version>/bin/opt'