Created
February 17, 2021 14:39
-
-
Save dnpp73/4f9c12ad96909355a39b99e22e42eb14 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# place this shell script to | |
# ./ | |
# ├── bin/ | |
# │ └── ibdesignable-workaround.sh | |
# └── YourGreatApp.xcodeproj | |
set -euo pipefail | |
if [ "$(uname -m)" != 'arm64' ]; then | |
echo '[INFO] This workaround script is M1 Mac Only.' | |
exit | |
fi | |
SRCROOT=$(cd "$(dirname "$0")/../" || exit 1; pwd) | |
echo "SRCROOT: ${SRCROOT}" | |
cd "${SRCROOT}" || exit 1 | |
# get 'YourGreatApp' string from './YourGreatApp.xcodeproj' | |
PROJECT_NAME=$(find . -maxdepth 1 -name '*.xcodeproj' | cut -d '/' -f2 | cut -d '.' -f1) | |
PROJECT="${PROJECT_NAME}" | |
echo "PROJECT: ${PROJECT}" | |
echo "PROJECT_NAME: ${PROJECT_NAME}" | |
# find /${PROJECT_NAME}-[a-z]{28}/ named directory from default DerivedData | |
cd "${HOME}/Library/Developer/Xcode/DerivedData" || exit 1 | |
BUILD_DIR="$(find . -maxdepth 1 -type d -regextype posix-basic -regex "\./${PROJECT_NAME}-[a-z]\{28\}")" | |
cd "${BUILD_DIR}/Build/Products" || exit 1 | |
BUILD_DIR=$(pwd) | |
BUILD_ROOT="${BUILD_DIR}" | |
echo "BUILD_DIR: ${BUILD_DIR}" | |
echo "BUILD_ROOT: ${BUILD_ROOT}" | |
# workaround | |
find . -maxdepth 1 -name '*-iphonesimulator' -print0 | while read -r -d '' file; do | |
echo "[info] rm -rf '${file/-iphonesimulator/-iphoneos}'" | |
rm -rf "${file/-iphonesimulator/-iphoneos}" | |
echo "[INFO] cp -r '${file}' '${file/-iphonesimulator/-iphoneos}'" | |
cp -r "${file}" "${file/-iphonesimulator/-iphoneos}" | |
done | |
echo '[INFO] Done! restart your Xcode' |
run this sh,but show blow message,
[INFO] This workaround script is M1 Mac Only.
my macbook is M1 Pro Max
@simonwellchang
Perhaps your terminal is running on Rosseta 2.
This workaround is for Xcode 12. It is no longer needed after Xcode 13.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yes, it works. very very very very very thanks
yes, it works. very very very very very thanks