Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Remove the comments automatically added by Xcode 4.4 to newly created files

View removeXcodeTemplateFluff.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#!/bin/bash
 
# WARNING: USE AT YOUR OWN RISK
# 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
 
# http://www.bobmccune.com/2012/03/04/creating-custom-xcode-4-file-templates/
export X1="/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates"
export X2="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates"
 
# 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
Owner

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' '{}' ';'
Owner
mx4492 commented

Forgot I'd posted this. Here is the newer incarnation (which is the same):
https://gist.github.com/mx4492/81da9f3c363bc1c44f4e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.