[Mac] clangdをインストールする

Macにclangdを入れてみました。
目的はVimでLSPを使った補完機能を試すためです。

環境

  • macOS 10.14.2

インストール方法

入れるのは簡単で、brewを使って以下のコマンドを実行するだけです。
インストールにやたら時間がかかります。
トータル1時間ちょっとかかったようです。

$ brew install llvm
:
==> Summary
🍺  /usr/local/Cellar/llvm/7.0.1: 5,351 files, 2.8GB, built in 67 minutes 25 seconds
:
llvm 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 llvm first in your PATH run:
  echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile
 
For compilers to find llvm you may need to set:
  export LDFLAGS="-L/usr/local/opt/llvm/lib"
  export CPPFLAGS="-I/usr/local/opt/llvm/include"

最後にllvmのパスを通して終了です。

$ echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile

clangdが実行できるようになりました。

$ clangd --version
clangd version 7.0.1 (tags/RELEASE_701/final)

0 件のコメント :

コメントを投稿