Skip to content

Instantly share code, notes, and snippets.

@dzenbot
Last active November 20, 2016 20:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dzenbot/918f8b65a51a2dd378c567579ca99077 to your computer and use it in GitHub Desktop.
Save dzenbot/918f8b65a51a2dd378c567579ca99077 to your computer and use it in GitHub Desktop.
CoreText header files are missing for the watchOS Simulator. This little script copies them from watchOS SDK easily.
#!/bin/sh
# CoreText.framework is missing for the watchOS Simulator (but is available on the device platform SDK)
# https://openradar.appspot.com/27844864
#
# This script is a quick patch to solve this issue, so we are all capable of running CoreText APIs on the Watch simulator too,
# by copying the WatchOS SDK's CoreText header files into the WatchSimulator's. This works great, although since editing the SDK files
# is protected, it needs to be run with sudo.
# Returns the appropriate platform path containing the framework headers
function headersPath() {
# Main Xcode path
XCODE_PATH=$( xcode-select --print-path )
echo "${XCODE_PATH}/Platforms/${1}.platform/Developer/SDKs/${1}.sdk/System/Library/Frameworks/${2}.framework/Headers/"
}
CoreText_WatchOS_Headers_Path=$( headersPath "WatchOS" "CoreText" )
CoreText_WatchSimulator_Headers_Path=$( headersPath "WatchSimulator" "CoreText" )
# Only perform if the CoreText framework headers are missing in the WatchSimulator
if [ ! -d ${CoreText_WatchSimulator_Headers_Path} ]; then
echo "Patch:$(tput setaf 1) Missing CoreText headers for WatchSimulator at path '${CoreText_WatchSimulator_Headers_Path}'.$(tput sgr0)"
# Copies the header files
sudo cp -R ${CoreText_WatchOS_Headers_Path} ${CoreText_WatchSimulator_Headers_Path}
echo "Patch:$(tput setaf 2) CoreText headers copied! You can now run your WatchOS apps using CoreText on the simulator.$(tput sgr0)"
else
echo "Patch:$(tput setaf 2) CoreText headers are already available on the WatchOS simulator.$(tput sgr0)"
fi
@steipete
Copy link

steipete commented Nov 6, 2016

@dzenbot
Copy link
Author

dzenbot commented Nov 20, 2016

Maybe something @russbishop could have a look too?

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