title: How to use xcodebuild command line to do automatic signing with Xcode9?
body: <p>I have Xcode9 installed on my OSX machine. I am using <code>xcodebuild</code> command line to sign my app which of course uses the latest Xcode9 based commaline tools.</p>
  
  <p>Following is the way I am trying to sign my app:</p>
  
  <pre><code>xcodebuild -project "MyProject.xcodeproj" -scheme "MyProject" -sdk "iphoneos" -configuration Release PROVISIONING_PROFILE="MyProject_ProvisioningProfile" DEVELOPEMENT_TEAM="MY_TEAM_ID"
  </code></pre>
  
  <p>But, it gives the following error.</p>
  
  <pre><code>Code Signing Error: Provisioning profile "profile_name" is Xcode managed, but signing settings require a manually managed profile.
  Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.0'
  </code></pre>
  
  <p>But when I build using Xcode9 UI IDE selecting "<em>Automatic signing</em>", it works. I want to replicate the same using <code>xcodebuild</code> command line.</p>
  
  <p>I read that with Xcode 9 installed, we can do automatic signing from command line just like Xcode UI does. </p>
  
  <p><strong>Question:</strong><br>
  How should I modify <code>xcodebuild</code> command to do automatic signing just the way it is done on Xcode UI based tool?</p>
  
  <p>I understand from <a href="https://developer.apple.com/library/content/qa/qa1814/_index.html" rel="nofollow noreferrer">official documentation</a> that one should prefer automatic signing. But how to do this with <code>xcodebuild</code> command line</p>
  
  <p>Looking at <a href="https://stackoverflow.com/questions/39500634/use-xcodebuild-xcode-8-and-automatic-signing-in-ci-travis-jenkins-environmen">this discussion</a>, I tried switching it on the <code>project.pbxproj</code> file using <code>sed</code>.</p>
  
  <pre><code>sed -i '' 's/ProvisioningStyle = Manual;/ProvisioningStyle = Automatic;/' &lt;ProjectName&gt;.xcodeproj/project.pbxproj
  </code></pre>
  
  <p>But that didn't help</p>