Open your gif in preview.app
save it like an pdf. I do this like this:
File -> Print
I choose the image to be without borders and so and klick on
PDF -> Save as PDF
then use automator app:
1 Choose new workflow
2 Drag your PDF in the empty space
3 Choose PDF
4 "PDF to images" drag under your file
5 Set were you want to save it and its name (your_file)
6 Run
Then follow this:
You will get n-frames PDF files names your_filen.pdf where n is the number of the frame. Let's use these files into our Beamer/LaTeX source file :
In the header part, do not forget to add :
\usepackage{animate} %need the animate.sty file
Then, where you need to display your animation : \animategraphics[autoplay,loop,height=5cm]{1}{your_file}{1}{n}