Fixing Flyspell for Emacs in Mac OS X

I use the flyspell-mode as a spell checking mechanism in emacs. Recently, I moved to Mac OS X, and I began to get this error whenever I started emacs:

Error enabling Flyspell mode:
(Searching for program No such file or directory aspell)

I had installed aspell with Homebrew. The issue seemed to be that Emacs was unable to find the aspell binary. Homebrew installs binaries in /usr/local/bin and it was in my $PATH. It turns out Emacs uses it’s own exec path to look for binaries to execute in sub-processes. So the fix is to add the /usr/local/bin path to the exec-path. This is the change needed to the ~/.emacs file: