How do I use llvm-profdata in Mac OS X Yosemite?

I have a simple question: how do I use the llvm-profdata binary provided by XCode's Command Line Tools in the terminal?

I have installed the Command Line Tools and could see the binary in /Library/Developer/CommandLineTools/usr/bin/, like this:

$ ls /Library/Developer/CommandLineTools/usr/bin/ | grep llvm
llvm-cov
llvm-profdata

I know I could make it work by adding the path to /etc/paths, but I'm not sure what other side effect will occur if I do that.

For reference, here's my current /etc/paths:

$ cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

I also have homebrew installed, if that matters.


Generally speaking installing XCode and/or the command line tools should have added those paths to your shell path variable. Odd that it didn't. Perhaps someone with more familiarity with XCode can help with that.

You could just type the whole path to the app every time you want to use it. But that would be a PITA.

Adding the path to those apps does not affect anything else, it only gives you easy access to the apps/commands in the path. If there are apps there that are literal duplicates of others in your path that might be a problem but all adding to your path variable does is tell the terminal to "look in this location for commands too."


You need to use the xcrun tool which will be in your path.

$ xcrun llvm-profdata <args>

The xcrun tool will execute the tool from the currently selected developer tools installation.

If you have Xcode installed you can select which developer tools are used with xcode-select. For example, if you have a beta version installed you can use that version of the command line tools with:

$ sudo xcode-select -s "/Applications/Xcode-beta.app"

and switch back with

$ sudo xcode-select -s "/Applications/Xcode.app"