Applying patches on Mac OS X

Once you're in the correct folder, run this command using the exact name of the patch file:
$ patch < example.patch
(note: don't type the dollar sign. That's the command line prompt.)

And voila! If the patching was successful then you will see one or more lines such as "patching file example.extension" followed by a new $ prompt and a flashing cursor (which is Unix' way of being really, really excited that something worked.) The original module, example.module, is now patched and ready for action. Yep, it's just that easy! You can now close the Terminal window and go pour yourself a well-deserved drink.

If you are patching core then remember to patch from the drupal root directory and use the -p0 parameter to patch. This will stop patch from asking you which file you wish to patch:
$ patch -p0 < example.patch

If your patch is patching files that mention a & b directories in the patch, you can use the -p1 parameter to get rid of the a/b directories.
$ patch -p1 < example.patch

To fix code style issues in the patch, you can use tab2space like so:
tab2space -unix -t2 foo.patch | patch -p0