To run V-REP in true headless mode, you have to compile it your self. This tutorial will explain exactly how to do that. I am as always working in an Ubuntu 18.04 environment, so keep that in mind.

First you will have to install some packages required for compiling V-REP. These can be installed using the following command:

sudo apt-get update && sudo apt-get install -y lua5.1 lua5.1-doc lua5.1-lgi lua5.1-lgi-dev lua5.1-policy lua5.1-policy-dev liblua5.1-0 liblua5.1-0-dbg liblua5.1-0-dev liblua5.1-dev libboost-all-dev

Now you need to make a new directory in which you will compile V-REP. I will use a directory called mybuild in my home directory:

mkdir ~/mybuild && cd ~/mybuild

Then you need to clone the V-REP repository to your install directory:

git clone https://github.com/CoppeliaRobotics/v_rep.git

To compile V-REP, several additional repositories are also needed. These should be placed in a programming directory as follows:

mkdir ~/mybuild/programming && cd ~/mybuild/programming
git clone https://github.com/CoppeliaRobotics/include.git
git clone https://github.com/CoppeliaRobotics/common.git
git clone https://github.com/CoppeliaRobotics/v_repMath.git

Now you need to create the makefile specifying that V-REP should be compiled in headless mode. You can download mine here (which also fixes various bugs with the default one). Please place this makefile inside the ~/mybuild/v_rep directory.

You are now ready to compile V-REP:

cd ~/mybuild/v_rep && make

It is unfortunately not possible to run the compiled V-REP directly. Instead, we have to download a pre-compiled version of V-REP from here and then move the libv_rep.so from the newly compiled V-REP to the pre-compiled one. In the following, I have downloaded V-REP and placed it in a directory called V-REP_PRO_EDU_V3_6_1_Ubuntu18_04_headless in my home directory. Using the following command, the libv_rep.so is copied from the compiled to the pre-compiled V-REP directory:

cp -f ~/mybuild/v_rep/lib/libv_rep.so ~/V-REP_PRO_EDU_V3_6_1_Ubuntu18_04_headless/libv_rep.so

You should now be able to launch V-REP in headless mode:

~/V-REP_PRO_EDU_V3_6_1_Ubuntu18_04_headless/vrep.sh

You can follow this tutorial to see what commands can be used for V-REP in headless mode. Also see this tutorial on how to have multiple instances of V-REP simulationsly.

Plase contact me if you find any mistakes or bugs in this tutorial