How can I open from the command line on a Mac more than 15 pdf files, 1 file per window, in separate staggered windows in a single app?
I am using Preview as the default pdf viewer. I have not explored other pdf viewers. I prefer a solution with Preview for simplicity, but I am open to using other pdf viewers.
I have tried commands below. Up to 15 files, it works fine in Preview. But file number 16 and subsequent files open as separate tabs in the existing windows (I want to open them in separate windows, not tabs):
open file1.pdf file2.pdf ...
or
open file1.pdf
open file2.pdf
...
By contrast, the commands below open multiple instances of the same app (Preview). And the windows are on top of each other (not staggered). So this does not work for me either:
open -n file1.pdf
open -n file2.pdf
...
I cannot use Finder to select and open files. The file names above are printed into STDOUT by running a different command. I am trying to open 20-40 such files at the same time, out of 1000s of files in one directory.
I am using these settings:
System settings:
Desktop & Dock > Windows > Prefer tabs when opening documents = never
Preview:
Settings > Images > Open each file in its own window = yes
See also:
- Display several files in one Preview window on Mac – Apple Support – This did not work, I still have a 15 file limit.
- Preview: Opening more than 12 pdf files in new windows – Ask Different – An old question, listing a different maximum file number limit, but it still has no answer.
- How to merge multiple PDF files onto one page with pdftk? – This is not what I am looking for: I do not need to merge pdf files into one (I know how to do that). I need to open them in separate tiled windows to be able to move them around the screen.
- How do I open lots of Preview windows on macOS Monterey? – Apple Community – No solution to this exact issue either (via Cpt.Whale).
Best Answer
A user here mentions that the Window menu still behaves like each tab is a separate window: https://discussions.apple.com/thread/253901021, so the behavior should be unique to Preview and not affect other pdf viewers.
These work:
Install another pdf viewer app like Skim
Then in the Terminal:
open -a /Applications/Skim.app file1.pdf file2.pdf ...
(optional) In Skim: hold the Option key + Window | Arrange in front. The windows are now tiled even more neatly (in a single cascading set).