Please note: If you get this error using Mac OS and Arduino IDE, the Xcode Command Line tools are not installed.
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun exit status 1 Compilation error: exit status 1
Simply open the terminal and run:
xcode-select --install