How can I apply a patch file to a Mac Ports app? I want to use the CD-ripping utility abcde, which I've installed via Mac Ports. I've run afoul of a problem in abcde, which is described in their bug database. Someone made a patch file musicbrainz2.patch which I think will solve the problem nicely.

My obstacle is that this patch hasn't been incorporated into the version 2.4.2 of abcde which is distributed by Mac Ports. Thus I'd like to apply this patch manually. But I can't figure out how to apply the patch to abcde as installed on my system.

The Mac Ports Guide section 4.5. Patch Files seems to be talking about how to patch Mac Ports portfiles and other distribution logic. It doesn't seem to talk about how to patch delivered utilities as installed.

The patch file includes file name references like (abbreviated):

--- debian/control  (revision 292)
+++ debian/control  (working copy)
@@ -12,7 +12,7 @@
 Architecture: all
-Suggests: eject, distmp3, ..., mp3gain, python-musicbrainz
+Suggests: eject, distmp3, ..., mp3gain, python-musicbrainz2


(This is the full abcde issue 3 patch file musicbrainz2.patch, and I can add it to the question if there is interest.)

I'm skeptical that I'll find path names with "debian" in them on my Mac OS X 10.5.8 installation. And the specific contents of debian/control don't match what's in the Mac Ports portfile for abcde. But other file in the patch file do correspond to files in my installation of abcde.

How can I apply this patch to my copy of abcde as installed by MacPorts? Is there a technique which will work in general for this kind of patch file on installations from Mac Ports?
That sort of patch file is what macports refers to, however each patch would need to be in a separate file.

However this case is more complex as you need to patch two things as you have spotted.


Make the program compile and run under OSX which the current macport will have done. In this case this will include fixing the paths with debian in.
Add the extra changes you have in the patch.


As a first start I would note that each macport has a maintainer who can be seen in the result of port info abcde and I would contact them with the issue. If unfortunately there is no maintainer as is true here then it might be worth asking on the macports user mailing list if someone else could do the patch.