In this work a heuristic algorithm known as the fruit fly optimization algorithm is applied to the optimization of waveguide devices. First the original formulation and operating principles of the algorithm are presented and then it is adapted for the waveguide optimization problem. To demonstrate the usefulness of this algorithm two different devices (a waveguide transformer and a band-pass filter) are optimized using the fruit fly optimization algorithm along with a Mode-Matching software to compute their response. The achieved results are compared with the ones provided by a simplex method.