title: Old path persists in XCode framework build
body: <p>The following script is part of an aggregate target build phase that is supposed to be used to combine simulator and device targets into one universal framework build. The build originated from <a href="https://stackoverflow.com/questions/27284192/xcode6-creating-fat-static-library-ios-universal-framework">this SO answer</a>. </p>
  
  <pre><code>set -e 
  
  FRAMEWORK_NAME="${PROJECT_NAME}"
  
  SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FRAMEWORK_NAME}.framework"
  
  DEVICE_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphoneos/${FRAMEWORK_NAME}.framework"
  
  UNIVERSAL_LIBRARY_DIR="${BUILD_DIR}/${CONFIGURATION}-iphoneuniversal"
  
  FRAMEWORK="${UNIVERSAL_LIBRARY_DIR}/${FRAMEWORK_NAME}.framework"
  
  
  ######################
  # Build Frameworks
  ######################
  echo "PROJECT_NAME: ${PROJECT_NAME}"
  echo "CONFIGURATION: ${CONFIGURATION}"
  echo "BUILD_DIR: ${BUILD_DIR}"
  echo "SIMULATOR_LIBRARY_PATH: ${SIMULATOR_LIBRARY_PATH}"
  echo "DEVICE_LIBRARY_PATH: ${DEVICE_LIBRARY_PATH}"
  echo "UNIVERSAL_LIBRARY_DIR: ${UNIVERSAL_LIBRARY_DIR}"
  
  xcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphonesimulator -target ${PROJECT_NAME} -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphonesimulator
  </code></pre>
  
  <p>Here is the first error I get when executing this script: </p>
  
  <pre><code>PROJECT_NAME: My-project_Framework
  CONFIGURATION: Debug
  BUILD_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products
  SIMULATOR_LIBRARY_PATH: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphonesimulator/My-project_Framework.framework
  DEVICE_LIBRARY_PATH: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphoneos/My-project_Framework.framework
  UNIVERSAL_LIBRARY_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphoneuniversal
  Build settings from command line:
      CONFIGURATION_BUILD_DIR = /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphonesimulator
      SDKROOT = iphonesimulator8.1
  
  === CLEAN TARGET My-project_Framework OF PROJECT My-project_Framework WITH CONFIGURATION Debug ===
  
  Check dependencies
  
  Create product structure
  /bin/mkdir -p /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphonesimulator/My-project_iOS.framework
  
  Clean.Remove clean /Volumes/local\ my-project/my-project/ios/Framework/build/My-project_Framework.build/Debug-iphonesimulator/My-project_Framework.build
      builtin-rm -rf /Volumes/local\ my-project/my-project/ios/Framework/build/My-project_Framework.build/Debug-iphonesimulator/My-project_Framework.build
  
  Clean.Remove clean /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphonesimulator/My-project_iOS.framework
      builtin-rm -rf /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphonesimulator/My-project_iOS.framework
  
  ** CLEAN SUCCEEDED **
  
  === BUILD TARGET My-project_Framework OF PROJECT My-project_Framework WITH CONFIGURATION Debug ===
  
  Check dependencies
  error: Unable to create directory: /Volumes/local my-project/my-project/ios/Framework/build (Permission denied)
  </code></pre>
  
  <p><strong>Now here is the problem</strong></p>
  
  <p>This mount point, <code>/Volumes/local my-project</code> (with a space) has been <em>replaced</em> with <code>/Volumes/localmy-project</code> (without a space). Yet XCode still seems to have the old path somewhere. </p>
  
  <p>Here's what I did to try rip it out of XCode (version 6.1.1): </p>
  
  <ol>
  <li>Added the <code>echo</code> calls to the script to show all the command line inputs to <code>xcodebuild</code>. As you can see this path doesn't come in from the command line call.</li>
  <li>Cleaned all targets (Choose each target, Product->Clean).</li>
  <li>Checked all the files included in this framework project - all of them have <code>location</code> set to <code>Relative to Project</code> in the inspector. </li>
  <li>Restarted XCode. </li>
  <li>Restarted the Mac. </li>
  <li>Checked <code>project.pbxproj</code> and all other XML files found in the project package contents - no absolute path to be found.</li>
  <li>Checked the target in the inspector - its location is absolute (cannot be changed) and correctly points to the new path (<code>/Volumes/localmy-project/...</code>)</li>
  <li>Went into the organizer and went Projects->My-Project->Derived Data->Delete.</li>
  </ol>
  
  <p>After all this, the error still persists. So - where the hell is XCode getting this old path from?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I've added the following <code>echos</code> to show a few more build environment variables according to @Louis Tur: </p>
  
  <pre><code>BUILT_PRODUCTS_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-Project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphoneos
  CACHE_ROOT: /var/folders/w1/v31fpgnd7sl0yp5ctqjgsxsh0000gn/C/com.apple.DeveloperTools/6.1.1-6A2008a/Xcode
  CONFIGURATION_BUILD_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-Project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphoneos
  CONFIGURATION_TEMP_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-Project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-Project_Framework.build/Debug-iphoneos
  SYMROOT: /Users/foouser/Library/Developer/Xcode/DerivedData/My-Project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products
  </code></pre>
  
  <p><strong>Update2 - Now with even more echos!</strong></p>
  
  <pre><code>DEPLOYMENT_LOCATION: NO
  DERIVED_FILE_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-project_Framework.build/Debug-iphoneos/My-project_Framework_Universal.build/DerivedSources
  DSTROOT: /tmp/My-project_Framework.dst
  INSTALL_DIR: /tmp/My-project_Framework.dst
  INSTALL_PATH: 
  OBJECT_FILE_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-project_Framework.build/Debug-iphoneos/My-project_Framework_Universal.build/Objects
  OBJECT_FILE_DIR_normal: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-project_Framework.build/Debug-iphoneos/My-project_Framework_Universal.build/Objects-normal
  OBJECT_FILE_DIR_debug: 
  OBJROOT: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates
  PROJECT_TEMP_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-project_Framework.build
  REZ_COLLECTOR_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-project_Framework.build/Debug-iphoneos/My-project_Framework_Universal.build/ResourceManagerResources
  REZ_OBJECTS_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-project_Framework.build/Debug-iphoneos/My-project_Framework_Universal.build/ResourceManagerResources/Objects
  SHARED_PRECOMPS_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/PrecompiledHeaders
  SRCROOT: /Volumes/localmy-project/my-project/ios/Framework
  TARGET_BUILD_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Products/Debug-iphoneos
  TARGET_TEMP_DIR: /Users/foouser/Library/Developer/Xcode/DerivedData/My-project_Framework-fjaslxiqhnitqxdksjbcxyuugfpk/Build/Intermediates/My-project_Framework.build/Debug-iphoneos/My-project_Framework_Universal.build
  </code></pre>
  
  <p>Still none of these point to the old path then..</p>