While trying to run a MATLAB script, I am getting the following error:

Compiling minFunc files...
Building with 'Xcode with Clang'.
Error using mex
xcrun: error: invalid active developer path (/Applications/Xcode.app/Contents/Developer), missing
xcrun at: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun

On searching further, I got the following solution to install command-line-tools using the command:

xcode-select --install

but it is giving me:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

On running brew config I got the following information:

HOMEBREW_VERSION: >=1.7.1 (shallow or no git repository)
ORIGIN: (none)
HEAD: (none)
Last commit: never
Core tap ORIGIN: (none)
Core tap HEAD: (none)
Core tap last commit: never
HOMEBREW_LOGS: /Users/swastik/Library/Logs/Homebrew
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: xcrun: error: invalid active developer path (/Applications/Xcode.app/Contents/Developer), missing xcrun at: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun
Git: N/A
Curl: 7.54.0 => /usr/bin/curl
macOS: 10.13.6-x86_64
Xcode: dunno

How to solve this problem?


Do a software update.

Go to Apple menu → System Preferences... → Software Update (on macOS Mojave) or Apple menu → App Store... → Updates (on earlier). Be sure to update Xcode. Then go back to Terminal and run

xcode-select --install

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .