Skip to content

Instantly share code, notes, and snippets.

@benjaminpearson
Created October 27, 2011 22:10
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 benjaminpearson/1321051 to your computer and use it in GitHub Desktop.
Save benjaminpearson/1321051 to your computer and use it in GitHub Desktop.
Remove Whitespace in Xcode as a Build Phase
- IMPORTANT: Using this will kill your undo history
Steps:
- In Xcode > Select your project > "Build Phases" > "Add Build Phase" > "Add Run Script"
- Paste this script:
sed -i '' 's/[[:space:]]*$//' `find . -name *.h -o -name *.m -not \( -name .svn -prune -o -name .git -prune \) -type f`
- Now whitespace will be removed from .h and .m files on build
- Only problem, doesn't work if path contains a space.... any ideas?
- NOTE: don't try this script out on your super important project that you haven't committed your changes to yet, I'm not a terminal pro and this could do something crazy that I haven't expected ;)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment