I faced this issue a few weeks back and was able to resolve it in the following manner.
The mailcatcher gem as of writing this depends on thin-1.5.1 which doesn’t install correctly.
Now, if you face the issue, uninstall the thin gem. Then,
gem install thin -v 1.5.1 -- --with-cflags="-Wno-error=implicit-function-declaration" gem install mailcatcher
And you should be good to go.
Here’s the StackOverflow link I followed with some tweaks.