Updated: fixed step 4 to work properly with filenames containing spaces.
I've used shell commands to rename projects a few times, and it worked better than renaming from Xcode itself. Here are the steps (given we want to rename warnings_test
=> BestAppEver
) (you may need to install a few extra tools with brew install rename ack
):
Find all files with name containing the source string:
$ find . -name 'warnings_test*'
./warnings_test
./warnings_test.xcodeproj
./warnings_test.xcodeproj/xcshareddata/xcschemes/warnings_test.xcscheme
./warnings_testTests
./warnings_testTests/warnings_testTests.m
Rename those files and directories:
$ find . -name 'warnings_test*' -print0 | xargs -0 rename -S 'warnings_test' 'BestAppEver'
You'll need to run this command a couple of times, because directories will be renamed first, then files and directories inside those will be renamed on the next iteration. Check with the step 1 if all the files are renamed (should see empty output).
Find all occurrences of the string in all the files:
$ ack --literal 'warnings_test'
Look through the output to make sure all those string should be replaced. In most cases, they should.
Replace all occurrences:
$ ack --literal --files-with-matches 'warnings_test' --print0 | xargs -0 sed -i '' 's/warnings_test/BestAppEver/g'
One run is enough. To verify, run the command in step 3 again, you should see empty output.
Done! All your targets, schemes, files, mentions in comments, identifiers, names, etc. have been renamed. If you git add .
and git status
, you should see a lot of renamed:
entries (just another sanity check).