I am trying to patch 5 files within an Mac application bundle using the Terminal patch
command. The files to be patch are specified using an absolute file path (the file name and path start with a slash).
The output when running $ sudo patch -i ~/custom.patch
is:
can't find file to patch at input line 3
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|--- /Applications/Xyz.app/Contents/Resources/dashboard.js
|+++ /Applications/Xyz.app/Contents/Resources/dashboard.js
--------------------------
File to patch: ^C
I have verified that the file /Applications/Xyz.app/Contents/Resources/dashboard.js does exist using at the specified file path using the ls
command.
Regression:
- Tried to run the patch command from root folder using
$ cd /
- Tried to run the patch command from root folder with the first slash removed, that results in an almost identical result:
can't find file to patch at input line 3
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|--- Applications/Xyz.app/Contents/Resources/dashboard.js
|+++ Applications/Xyz.app/Contents/Resources/dashboard.js
--------------------------
File to patch: ^C
How can multiple files within a Mac OS X Application bundle be patched using patch
?
Best Answer
I think the problem is that you are not specifying the p option.
From the manual for patch:
So the command should be something like:
or you could specify the directory to which the patch should be applied: