While building the ParaMonte MATLAB library on macOS, you may receive a compiler error message similar to the following,

xcrun: error: unable to find utility "clang", not a developer tool or in PATH

or particularly, after macOS automatic update to a more recent version, for example, macosx10.15.4,

MEX - xcodebuild: error: SDK "macosx10.15.4" cannot be located

To resolve this error,

  • Open MATLAB. On the MATLAB command line, type,
    compilerCfg = mex.getCompilerConfigurations
    open(compilerCfg(1).MexOpt)
    open(compilerCfg(2).MexOpt)
    
  • The above commands should open two MATLAB internal files named mex_C_maci64.xml and mex_C++_maci64.xml. Toward the ends of each one of these files, look for a line that is similar to, or exactly, the following,
    <SDKVER>
        <cmdReturns name="xcrun -sdk macosx --show-sdk-version"/>
    </SDKVER>
    
  • Once you find the lines, replace them with the following,
    <SDKVER>
        <cmdReturns name="xcrun -sdk macosx --show-sdk-version | cut -c1-5"/>
    </SDKVER>
    

    Once you make the changes, save boths files and close them.

  • Now, on the MATLAB command line, type,
    mex -setup C++
    mex -setup C
    
  • The above should hopefully fix the error. Now open a Bash terminal and rerun the same command that you originally used to build the ParaMonte library.


If you have any questions about the topics discussed on this page, feel free to ask in the comment section below or reach out to the ParaMonte library authors.