WARNING: Current Windows support is experimental.

Source Installation on Windows 10 or 11#

OGRE2 rendering capabilities are supported in Windows, and Gazebo GUI works in a limited fashion. These functionalities correspond to the currently building packages gz-rendering and gz-sim, respectively. The packages will build, without any failures when using their functionalities.

NOTE You should be able to use ogre as a rendering engine instead of the default ogre2. Just append --render-engine ogre to the command line.

Install dependencies#

  1. If you do not have the conda package manager installed in your system, install a conda distribution. As Gazebo uses all dependencies from the conda-forge channel, we suggest to install miniforge following the official miniforge installation docs by executing the following commands in a “Command Prompt” terminal:

    curl.exe -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Windows-x86_64.exe
    start /wait "" Miniforge3-Windows-x86_64.exe /InstallationType=JustMe /RegisterPython=0 /S /D=%UserProfile%\Miniforge3
    %UserProfile%\Miniforge3\condabin\conda init
    %UserProfile%\Miniforge3\condabin\conda config --set auto_activate_base false
    del Miniforge3-Windows-x86_64.exe
    

    If you followed this step correctly, you should be able to access conda in any new “Command Prompt” terminal you open. To verify that, check that if you open a new terminal and execute conda info, the output begins with:

      active environment : None
             shell level : 0
      [..]
    
  2. Install Visual Studio 2019 or 2022. The Community version is free for students, open-source developers, and personal development. Check “Desktop development with C++” in the Workloads tab, check “MFC and ATL support”, and uncheck “C++ Cmake Tools.” We will install cmake via Conda. All other checkboxes can be left unchecked.

  3. Open a Visual Studio Command Prompt (search for “x64 Native Tools Command Prompt for VS” in the Windows search field near the Windows button) or Developer PowerShell for VS (search for “developer powershell”). Optionally, right-click and pin to the task bar for quick access in the future.

    If you chose PowerShell, you need to do a few steps to be able to use Conda and Gazebo in it:

    conda init powershell
    # Restart the PowerShell
    Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
    
  4. Create and activate a Conda environment:

    conda create -n gz-ws
    conda activate gz-ws
    

    Once you have activated an environment, a prefix like (gz-ws) will be prepended to your prompt.

    You can use conda info --envs to see all of your environments.

    To speed up conda installations, also set the following to use libmamba solver. Older conda installations may need to do additional steps.

    conda config --set solver libmamba
    

    To remove an environment, use conda remove --all --name <env_name>.

    NOTE This way of Conda environment creation puts it into a default folder. If you need to install it elsewhere, use --prefix <env_path> instead of --name <env_name>. Environments in custom paths cannot be referenced by names, so even conda activate needs to be passed a path (relative or absolute) instead of the name. If you refer to a subdirectory of the current directory, you have to prepend .\ so that Conda knows it is a path and not a name.

  5. Install dependencies:

    conda install cmake git vcstool curl pkg-config ^
    colcon-common-extensions dartsim eigen freeimage gdal gts ^
    glib dlfcn-win32 ffmpeg ruby tinyxml2 tinyxml ^
    protobuf urdfdom zeromq cppzmq ogre=1.10 ogre-next jsoncpp ^
    libzip qt pybind11 boost --channel conda-forge
    

    This can take tens of minutes (or less when using libmamba solver).

  6. Navigate to where you would like to build the library, create and enter your workspace directory, create the src directory which will contain the Gazebo source code.

    mkdir gz-ws
    cd gz-ws
    mkdir src
    
  7. Then clone the repositories

    # CMD
    curl -sk https://raw.githubusercontent.com/gazebo-tooling/gazebodistro/master/collection-ionic.yaml -o collection-ionic
    vcs import src < collection-ionic
    
    # PowerShell
    curl https://raw.githubusercontent.com/gazebo-tooling/gazebodistro/master/collection-ionic.yaml -o collection-ionic
    vcs import --input collection-ionic src
    

Building the Gazebo Libraries#

Once the compiler and all the sources are in place it is time to compile them. Start the procedure by navigating to your workspace and listing the packages recognized by colcon:

colcon graph

colcon graph should list the Gazebo libraries with an interdependency diagram. If that is the case, then you are ready to build the whole set of libraries:

colcon build --cmake-args -DBUILD_TESTING=OFF -DSKIP_SWIG=ON --merge-install --packages-up-to gz-sim9 gz-tools2

Tests are turned off as they are not currently supported on Windows.

To build a specific package with all its dependent packages:

colcon build --merge-install --packages-up-to PACKAGE_NAME

To build a single package:

colcon build --packages-select PACKAGE_NAME

Visit colcon documentation to view more colcon build and test options.

If there are no errors, all the binaries should be ready to use.

Using the workspace#

The workspace needs to be sourced every time a new terminal is used ( and Conda environment activated before that).

The overall instructions for setting up a new terminal to use the built workspace are:

# CMD
conda activate gz-ws
call install\setup.bat

# PowerShell
conda activate gz-ws
.\install\setup.ps1

You should now be able to launch gazebo:

# Launch server in one terminal 
gz sim -s

# In separate terminal, launch gui
gz sim -g

This is the end of the source install instructions; head back to the Getting started page to start using Gazebo!

NOTE If your username contains spaces (which is quite common on Windows), you will probably get errors saying Invalid partition name [Computer:My User With Spaces]. Fix this by changing GZ_PARTITION to something else:

set GZ_PARTITION=test

Remember to set the same partition in all other consoles.

Gazebo GUI workaround#

Although running gz sim without arguments is not supported on Windows, the gz sim -g command is supported, and you can use it to launch the graphical interface on Windows.

This should allow you to run the GUI in a separate console, connecting to the server running in another console.

Uninstalling source-based install#

A source-based install can be “uninstalled” using several methods, depending on the results you want:

  1. If you installed your workspace with colcon as instructed above, “uninstalling” could be just a matter of opening a new terminal and not sourcing the workspace’s setup.bat. This way, your environment will behave as though Gazebo is not installed on your system.

  2. If, in addition to not wanting to use the libraries, you’re also trying to free up space, you can delete the entire workspace directory from within your conda environment with:

    rm -rf <workspace_name>
    
  3. If you want to keep the source code, you can remove the install / build / log directories as desired, leaving the src directory.

  4. Last, if you do not need the conda environment anymore, you can remove it with

    conda deactivate
    conda remove --all --name <env_name>
    # or conda remove --all --prefix <path_to_env> if you installed to custom path
    

Troubleshooting#

See Troubleshooting