Export LyX to LaTeX
Export *.lyx files automatically to LaTeX (pdfLaTeX in this case). This is one of the few things that work without starting the GUI. But hey, at least this works!
$ lyx --force-overwrite --export pdflatex thesis.lyx
Batch import CSV to LyX
Import every *.csv file of the current directory into a new LyX file and save it with a *.lyx extension. Makes adding several tables to a single document easier later on. It’s a bit slow because the LyX GUI is started for every *.csv file and closed again after importing.
But it works!
for I in *.csv; do /Applications/LyX.app/Contents/MacOS/lyx --import csv $I --execute lyx-quit; done