Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Instructions for running Ardupilot Simulation SITL within MacOS using XQuartz and Vagrant

Ardupilot Simulation (SITL - Simulation In The Loop) allows for safe testing of experimental code and settings and crashing virtual vehicles is a lot cheaper than crashing real ones!

It was written for X11/Linux. Fortunately thanks to Vagrant and XQuartz it can be run on MacOS.


Clone ardupilot and submodules:

git clone --recursive
cd ardupilot

If you already develop Ardupilot, you may need to clean out some folders modified within Vagrant:

rm -rf build

Edit Vagrantfile to setup X11 forwarding:

 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
   config.ssh.forward_x11 = true

Startup Vagrant/Virtualbox, using the ssh -X flag (via -- -X at the end of the command) to enable X11 forwarding:

cd Tools/vagrant
vagrant up

Perhaps the provision step fails; it might not matter. Carry on.

HOST_IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
xhost + $HOST_IP
vagrant ssh -c " -j 2 --console --map --out=$HOST_IP:14550 -v ArduPlane " -- -X

The SITL program should launch on your host machine (MacOS) within XQuartz. XQuartz will be launched for you when you run the xhost command above.

Host access to MAVLink

From your MacOS, you can now access the MAVLink traffic on port 14550.

For example, MAVProxy can connect: --master=

Similarly QGroundControl will immediately picked up the location of the plane from the simulator:


Suspending between sessions

Since it takes a while to run vagrant up the first time, you might like to use vagrant suspend to shutdown the VM between uses.


This comment has been minimized.

Copy link

commented Feb 11, 2019

use waf clean or waf distclean instead of rm -rf build .
The provision step shouldn't failed otherwise you will miss something..
don't pass -j 2 as waf will scale itself to available proc in the VM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.