MacOS – Odd Xcode error: Objective-C garbage collection is not supported

macosxcode

I have to administrate a remote macos machine. Today I logged in since some time off and I've got this error:

   $ make

  dyld: Library not loaded: @rpath/DVTFoundation.framework/Versions/A/DVTFoundation
      Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
      Reason: no suitable image found.  Did find:
        /Applications/Xcode.app/Contents/Developer/usr/bin/../../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation: cannot load '/Applications/Xcode.app/Contents/Developer/usr/bin/../../../SharedFrameworks/DVTFoundation.framework/Versions/A/DVTFoundation' because Objective-C garbage collection is not supported
    Please review and agree to the software license agreements!

Amy idea what this is about?

I've already installed Xcode (macOS Sierra version 10.12).

Can it be caused by the Sierra upgrade? Since I've installed Xcode under the previous version (Lion), and now it's broken?

It seems odd since I've installed Xcode Sierra version.

Update:

Apparently the error is triggered every time I use some Xcode tool,
for instance accepting the license via cli triggers the exact same error.

I have not already had access to the machine directly, but I'll try to reinstall all Xcode building tools.

Best Answer

That is an odd error as the framework request in question is coming from an Apple app.

It seems your Xcode has been updated to a newer version and the licence agreement needs to be accepted. You can do this two ways:

  1. Open Xcode.app and follow the prompts
  2. In Terminal: sudo xcodebuild -license
    (and with newer versions sudo xcodebuild -license accept to do it in one step)

Afterwards confirm xcode-select --print-path returns a valid result.

You should then be good to go, assuming your combination of macOS version and Xcode version are compatible.