Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 606
Andrew Spott Avatar asked May 14 '11 08:05

Andrew Spott


4 Answers

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.

like image 124
Pieter Avatar answered Nov 15 '22 17:11

Pieter


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).

like image 15
idbrii Avatar answered Nov 15 '22 16:11

idbrii


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.

like image 9
Andrew Spott Avatar answered Nov 15 '22 16:11

Andrew Spott


On macOS Catalina (newest, as of 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

As pointed out by @Daco Harkes the Xcode library does not include the Objective C headers, so you might want to use the Command Line Tools version anyway.

Additionally, this uses Apple's build of Clang which can be... quirky and doesn't implement all the newest features. So you might want to download the LLVM version, which you can download from their website or get from Homebrew's LLVM package (brew install llvm).

When installed through Homebrew the library can be found at:

/usr/local/opt/llvm/lib/libclang.dylib
like image 2
Misty Avatar answered Nov 15 '22 18:11

Misty