Skip to content

Instantly share code, notes, and snippets.

@acoomans
Created May 1, 2014 15:21
Show Gist options
  • Select an option

  • Save acoomans/59e316d7c66ebf3d52eb to your computer and use it in GitHub Desktop.

Select an option

Save acoomans/59e316d7c66ebf3d52eb to your computer and use it in GitHub Desktop.
Change Xcode build specs by merging OSX's specs in iPhone Simulator's specs
#!/bin/bash
# Change Xcode build specs by merging OSX's specs in iPhone Simulator's specs
# This allows to build dynamic libraries for the simulator
PLISTBUDDY="/usr/libexec/PlistBuddy"
ROOT=`xcode-select -print-path`
SIM_SPECS_DIR="$ROOT/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Specifications"
OSX_SPECS_DIR="$ROOT/Platforms/MacOSX.platform/Developer/Library/Xcode/Specifications"
SIM_PKG_SPECS="$SIM_SPECS_DIR/iPhone Simulator PackageTypes.xcspec"
SIM_PDT_SPECS="$SIM_SPECS_DIR/iPhone Simulator ProductTypes.xcspec"
OSX_PKG_SPECS="$OSX_SPECS_DIR/MacOSX Package Types.xcspec"
OSX_PDT_SPECS="$OSX_SPECS_DIR/MacOSX Product Types.xcspec"
if [ -f "$SIM_PKG_SPECS.backup" -o -f "$SIM_PDT_SPECS.backup" ] ; then
exit 1
fi
cp "$SIM_PKG_SPECS" "$SIM_PKG_SPECS.backup" || exit 1
cp "$SIM_PDT_SPECS" "$SIM_PDT_SPECS.backup" || exit 1
$PLISTBUDDY -c "Merge \"$OSX_PKG_SPECS\"" "$SIM_PKG_SPECS"
$PLISTBUDDY -c "Merge \"$OSX_PDT_SPECS\"" "$SIM_PDT_SPECS"
echo "Package and product types specs were changed."
echo "Restart Xcode for the changes to take effect."
@acoomans

acoomans commented May 1, 2014

Copy link
Copy Markdown
Author

Works for 5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment