Skip to content

Instantly share code, notes, and snippets.

@alvaroroyo
Last active September 13, 2022 18:05
Show Gist options
  • Save alvaroroyo/227d9830eb9d0d8283edd66d9d6f149e to your computer and use it in GitHub Desktop.
Save alvaroroyo/227d9830eb9d0d8283edd66d9d6f149e to your computer and use it in GitHub Desktop.
#Set here your Environment.plist name
ENVIRONMENT="DEV"
#Environment.plist path
ENVIRONMENT_PLIST="$PROJECT_DIR/AppName/Environments.plist"
#Get app name from Environment.plist
APP_NAME=$(/usr/libexec/PlistBuddy -c "Print :$ENVIRONMENT:APP_NAME" "$ENVIRONMENT_PLIST")
#Get bundle identifier from Environment.plist
BUNDLE_ID=$(/usr/libexec/PlistBuddy -c "Print :$ENVIRONMENT:BUNDLE_IDENTIFIER" "$ENVIRONMENT_PLIST")
#Set environment app name in Info.plist
/usr/libexec/PlistBuddy -c "Set :CFBundleName ${APP_NAME}" "${INFOPLIST_FILE}"
#Set environment bundle identifier in Info.plist
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier ${BUNDLE_ID}" "${INFOPLIST_FILE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment