To install the needed components you can use Homebrew
Use Homebrew to install pandoc:
brew install pandoc
Then use Homebrew to install the PDFLaTex program.
brew install --cask mactex-no-gui
You should now have all the needed components but it won't work until you restart your terminal.
The idea is to be able to create an html file using css for styling
pandoc file.md -o file.html -s --css=style.css
In this case, you can use either css for styling, but it requires an intermediary step markdown to html and then print as PDF.
pandoc file.md -o file.html -s --css=style.css
Or you can do the styling with LaTex in which case you can go directly from markdown to PDF:
pandoc file.md -o file.pdf --template=latexstyle.tex
Inspiration :
https://gist.github.com/ilessing/7ff705de0f594510e463146762cef779#file-pandoc-markdown-to-pdf-md