I'm running IGV in batch mode following the steps described in the [IGV website](https://software.broadinstitute.org/software/igv/batch).

When I enter a command like the following one in the terminal, IGV opens, runs as expected, and saves a snapshot. Everything OK.

    bash igv.sh --batch=script.txt

However, this is done by opening IGV including its graphical user interface (GUI). I think this is unnecessary and probably slows the program, but so far I have not been able to run IGV in batch mode without a GUI being opened automatically, nor when I remove the `new` header command in the script, which is supposed to "open a new session" .

Any ideas on how to run IGV purely in CLI mode?
Yes. Check out the script here, which can create and run your IGV snapshots on a .bam file with a .bed file as target regions to snapshot:

https://github.com/stevekm/IGV-snapshot-automator

It uses xvfb in an automated fashion as described by Pierre.

If you just want the CLI command to use, it would be something like this:


    xvfb-run --auto-servernum --server-num=1 java -Xmx4000m -jar bin/IGV_2.3.81/igv.jar -b igv_script.bat

Note that `xvfb-run` is a wrapper script that usually comes with your system's `xvfb` installation, but may be platform-specific.