clang_complete: where is the libclang.{so,dylib} in OS X?

17,224

Solution 1

On macOS Catalina(newest, while posting) you can find it in the Xcode application, here:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib

As well as outside of it if you just use Command Line Tools and you don't have Xcode.app installed, here:

/Library/Developer/CommandLineTools/usr/lib/libclang.dylib

Solution 2

With the latest (appstore) XCode 4.3.2, the location changed, it can now be found in

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib

The /Developer directory, among others, no longer exists by default. Everything is now packaged inside the XCode application, so that delta updates from the appstore work.

Solution 3

You can always do a search of your filesystem. There are several ways.

On a Mac with Spotlight this is probably the best:

mdfind -name libclang.dylib

However most UNIX systems also have a locate database, which can be searched easily:

locate libclang.dylib

And when all else fails you can iterate through the file system (rather slowly) using find:

find / -type f -name libclang.dylib -o -name libclang.so

You'll get some errors about unreadable locations because they're only readable by root, but that's fine (hide these errors with 2> /dev/null).

Solution 4

I found the answer:

In OS X, with XCode 4 installed, libclang.dylib is at /Developer/usr/clang-ide/lib/libclang.dylib

This is just posted for those who are interested in the answer.

Share:
17,224

Related videos on Youtube

Andrew Spott
Author by

Andrew Spott

Broadly Skilled Data Geek.

Updated on January 12, 2021

Comments

  • Andrew Spott
    Andrew Spott over 3 years

    I looked in the usual places (/usr/lib/,/Developer/usr/lib/,/usr/local/lib), and it isn't there.

    If it isn't installed, does anyone know where I can find instructions to install it?

    Thanks!

    I'm not sure if I should close this, but I found the answer I was looking for:

    In OS X, with XCode 4 installed, libclang.dylib is at /Developer/usr/clang-ide/lib/libclang.dylib

    • GWW
      GWW about 13 years
      One small tip, I recommend that you install the latest version of clang (if you haven't already) the one bundled with OSX is quite outdated.
    • Andrew Spott
      Andrew Spott about 13 years
      @GWW: Do you know any good tutorials for doing so? the LLVM and CLANG websites are geared toward compiling and installing the debug version of clang, not a release version, and I don't know the configure flag to change that.
    • osgx
      osgx about 13 years
      Add an '--enable-optimized' option to ./configure script of llvm
    • haggai_e
      haggai_e about 13 years
      I think it is common in this case to answer the question yourself, and then accept it.
  • Krumelur
    Krumelur almost 13 years
    Or "mdfind -name libclang.dylib", which is a ton quicker :)
  • Kris Jenkins
    Kris Jenkins over 12 years
    Or locate libclang.dylib, for a third option.
  • Daco Harkes
    Daco Harkes about 2 years
    Please note that the Command Line Tools has the Objective C headers pre-included, but the Xcode one doesn't. (If one was interested in parsing ObjectiveC as well.) github.com/dart-lang/ffigen/pull/402#issuecomment-1154348670