gs -q -sDEVICE=pdfwrite -o merged.pdf tobemerged1.pdf tobemerged2.pdf tobemerged3.pdf
I installed it with Homebrew, but the project home is yonder: https://www.ghostscript.com/
I installed it with Homebrew, but the project home is yonder: https://www.ghostscript.com/