title: Installing brew on Mac OS 10.12 getting xcode license agreement error
body: <p>I am trying to install Homebrew on Mac 10.12 with the command:</p>
  
  <pre><code>/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  </code></pre>
  
  <p>On running this, I am getting an error:</p>
  
  <pre><code>You have not agreed to the Xcode license.
  Before running the installer again please agree to the license by opening
  Xcode.app or running:
      sudo xcodebuild -license
  </code></pre>
  
  <p>So I run <code>sudo xcodebuild -license</code> command then again got another error which is:</p>
  
  <pre><code>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!
  </code></pre>
  
  <p>I looked into this error also but no luck. While looking into this, I tried to reinstall xcode with the command:</p>
  
  <pre><code>xcode-select --install
  </code></pre>
  
  <p>Then I check for xcode installation by:</p>
  
  <pre><code>/usr/bin/xcode-select -print-path
  </code></pre>
  
  <p>The path printed, which seems to be correct, is:</p>
  
  <pre><code>/Applications/Xcode.app/Contents/Developer
  </code></pre>
  
  <p>Now can please somebody help me in accepting license agreement for xcode? This is where I am stuck and not able to move forward. Any suggestions or my error correction will be commendable.</p>