The following instructions demonstrate how to patch and compile Bash manually on OS X. The instructions were tested on OS X 10.9.5, but should work on earlier versions of the operating system.
First, you need to ensure that the latest version of Xcode is on your system. You can download this from the App Store for free. Next, open a terminal and accept the Xcode license agreement: