Skip to content

Instantly share code, notes, and snippets.

@rjstelling
Last active October 9, 2019 12:05
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save rjstelling/4339226 to your computer and use it in GitHub Desktop.
Save rjstelling/4339226 to your computer and use it in GitHub Desktop.
SEE: https://github.com/rjstelling/Xcode-Project-Validate. A very simple shell script to read .xcodeproj files and check if there are issues with the CODE_SIGN_IDENTITY. Having multiple entries can cause build errors (especially when Archiving or command line building). Link to StackOverflow question answering some questions about when and why t…
# /bin/bash
#Usage: $ ./cs_xproj_validate.sh path/to/xcode/project/file/theproject.xcodeproj
#More info: http://stackoverflow.com/q/13962341/89035
PROJECT_FILE="$1/project.pbxproj"
PREVIOUS_LINE=-1
for LINE in `cat "$PROJECT_FILE" | grep -n CODE_SIGN_IDENTITY | grep -o -E '^([0-9]*)'`
do
TEMP=`expr $PREVIOUS_LINE + 1`
if [ $TEMP -eq $LINE ] ; then
echo "There is a Code Signing Identity (CODE_SIGN_IDENTITY) issue in $PROJECT_FILE at line $PREVIOUS_LINE."
exit 1
fi
PREVIOUS_LINE=$LINE
done
exit 0
@Dan2552
Copy link

Dan2552 commented Mar 11, 2013

Thanks so much! I was at the point of considering revoking everything and redoing it all.

@almazini
Copy link

almazini commented Mar 1, 2015

permission denied :(

@lolptdr
Copy link

lolptdr commented Apr 22, 2015

you may have to run the script as "sh cs_xproj_validate.sh path/to/xcode/project/file/theproject.xcodeproj" or "sh ./cs_xproj_validate.sh path/to/xcode/project/file/theproject.xcodeproj"

@chrisvxd
Copy link

@almazini make it executable first: chmod +x cs_xproj_validate.sh, then invoke it: ./cs_xproj_validate.sh

@rjstelling
Copy link
Author

Hi, I promoted this to a "real" repo: https://github.com/rjstelling/Xcode-Project-Validate

If you've made useful changes please submit a pull request.

@maietta
Copy link

maietta commented Oct 9, 2019

Hi, I promoted this to a "real" repo: https://github.com/rjstelling/Xcode-Project-Validate

If you've made useful changes please submit a pull request.

I don't see an original license for the code, yet you assigned MIT license to the script this person wrote. Doing this can get you in a lot of hot water. Please don't do this without asking first.

@rjstelling
Copy link
Author

Hi, I promoted this to a "real" repo: https://github.com/rjstelling/Xcode-Project-Validate
If you've made useful changes please submit a pull request.

I don't see an original license for the code, yet you assigned MIT license to the script this person wrote. Doing this can get you in a lot of hot water. Please don't do this without asking first.

Hi @maietta, thanks for your concern, but I'm the original code author so we're all good! 👍🏼

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