Motivated by a recent experiment [Nadj-Perge et al., Science 346, 602 (2014)] providing evidence for Majorana zero modes in iron chains on the superconducting Pb surface, in the present work, we theoretically propose an all-optical scheme to detect Majorana fermions, which is very different from the current tunneling measurement based on electrical means. The optical detection proposal consists of a quantum dot embedded in a nanomechanical resonator with optical pump-probe technology. With the optical means, the signal in the coherent optical spectrum presents a distinct signature for the existence of Majorana fermions in the end of iron chains. Further, the vibration of the nanomechanical resonator behaving as a phonon cavity will enhance the exciton resonance spectrum, which makes the Majorana fermions more sensitive to be detectable. This optical scheme affords a potential supplement for detection of Majorana fermions and supports to use Majorana fermions in Fe chains as qubits for potential applications in quantum computing devices.