I am trying to open a file on an smb share in preview from terminal. The following command opens the containing folder in finder instead of the file in preview.
open -a /Applications/Preview.app "smb://myshare._smb._tcp.local/path/to/file/my_file.pdf"
Update 1: I tried with and without the -a switch. The same thing happens in both cases: finder is opened with the last folder (/path/to/file). Preview is already associated with PDFs, so it should open automatically.
Best Answer
Just use
/Applications/Preview.app/Contents/MacOS/Preview /path/to/file.pdf
instead of/Applications/Preview.app /path/to/file.pdf
and it should work.