From c1307f5abc7f162f7ed2594f73125dc46ce3cee1 Mon Sep 17 00:00:00 2001 From: Myk Melez Date: Fri, 20 May 2022 09:28:13 -0700 Subject: [PATCH] suggest running setup.sh as root for App Store-installed Xcode --- README.md | 2 +- setup.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 200bef9..45fab14 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ You can check your UUID with this command: ```sh $ defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID ``` -Once the UUID is added, execute the `setup.sh` script +Once the UUID is added, execute the `setup.sh` script. If /Applications/Xcode.app is installed via the App Store, then you'll need to run the script as root (for example, via `sudo setup.sh`) to successfully install the language specifications and metadata files. You may have to quit and reopen Xcode once or twice and click the `Load Bundle` button in a popup that should appear automatically. diff --git a/setup.sh b/setup.sh index 9e6a4ae..4a8cf3c 100755 --- a/setup.sh +++ b/setup.sh @@ -21,6 +21,13 @@ spec_dir="${xcode_path}/SharedFrameworks/SourceModel.framework/Versions/A/Resour # Copy the language specification to the specs directory cp Specifications/Rust.xclangspec $spec_dir + +result=$? +if [ $result -ne 0 ]; then + echo "Error copying Rust.xclangspec; do you need to run this script as root?" + exit $result +fi + #cp Specifications/Rust.xcspec $spec_dir # Get language metadata directory @@ -29,6 +36,12 @@ metadata_dir="${xcode_path}/SharedFrameworks/SourceModel.framework/Versions/A/Re # Copy the source code language plist to the metadata directory cp Xcode.SourceCodeLanguage.Rust.plist $metadata_dir +result=$? +if [ $result -ne 0 ]; then + echo "Error copying Xcode.SourceCodeLanguage.Rust.plist; do you need to run this script as root?" + exit $result +fi + defaults read ${xcode_path}/Info DVTPlugInCompatibilityUUID echo "Please restart Xcode"