Create a gist now

Instantly share code, notes, and snippets.

Remove the comments automatically added by Xcode 4.4 to newly created files
# requires SUDO
# Ideally, the Templates in the user's home directory should override the
# defaults, but I can't get this to work for Xcode 4.4, hence the following
# !! WORKAROUND !! hacky solution to edit them in place
# And this does not work completely, the files added when the default project
# is created seem to be unaffected, only subsequently added files are.
set -e
export X1="/Applications/"
export X2="/Applications/"
# For Debugging
set -x && set -v && set -o verbose
function replaceTemplate() { \
cp -r "$1" "$1.bak"
find -E "$1" -type f -regex '.*\.(c|h|m)' -exec sed -i '' '1,/^$/d' '{}' ';'
replaceTemplate $X1
replaceTemplate $X2

This is a bit dangerous. The first time around you might want to manually browse to the correct folders and run the following

find -E . -type f -regex '.*\.(c|h|m)' -exec sed -i '' '1,/^$/d' '{}' ';'

Forgot I'd posted this. Here is the newer incarnation (which is the same):

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