The Colcon Build Tool is a Python-based, meta-build system that orchestrates the compilation and installation of multiple packages in a ROS 2 workspace. It does not compile code directly but instead invokes the underlying native build systems—such as CMake for C++ or setuptools for Python—for each package. Its core function is to manage the dependency graph between packages, ensuring they are built in the correct order while providing a unified command-line interface for common operations like building, testing, and listing packages.
Glossary
Colcon Build Tool

What is Colcon Build Tool?
Colcon is the primary command-line build tool for the Robot Operating System 2 (ROS 2), designed to build multiple interdependent software packages within a workspace.
Colcon was created as the successor to catkin_make and catkin build from ROS 1, offering improved performance, better handling of mixed build systems, and enhanced user experience through extensible commands and parallel execution. Key features include out-of-source builds, workspace overlaying, and rich output verbosity options. It is the de facto standard for building ROS 2 applications, from simple tutorials to complex, multi-robot systems, and integrates seamlessly with the ROS 2 tooling ecosystem.
Key Features of Colcon
Colcon is the de facto build tool for ROS 2, designed to handle the complexities of building multiple interdependent packages from source in a workspace. It abstracts underlying build systems like CMake and Python setuptools, providing a unified, powerful command-line interface.
Workspace-Aware Builds
Colcon operates on a workspace—a directory containing source code for multiple ROS packages. Its core function is to build all packages in this workspace while respecting their dependency graph. It automatically determines the correct build order, ensuring dependent packages are built after their dependencies. This is essential for large, modular robotic software stacks where packages rely on messages, services, or libraries from other packages.
Build System Abstraction
Colcon is not a build system itself; it is a meta-build tool or build automation tool. It invokes the underlying build system for each package (e.g., CMake for C++, setuptools for Python). It provides a single command (colcon build) that:
- Detects the build system type for each package.
- Creates isolated build, install, and log directories (the
build/,install/,log/folders). - Handles environment setup, ensuring built packages are added to the local environment via
setupscripts. - This abstraction allows developers to work with a consistent interface regardless of the package's implementation language.
Parallelization and Caching
To accelerate build times, especially for large workspaces, Colcon supports parallel execution. Using the --parallel-workers or --parallel-builds argument, it can build independent packages simultaneously. It also implements intelligent caching: if a package's source code and configuration have not changed since the last successful build, Colcon can skip rebuilding it. This is controlled by the --cmake-clean-first and --symlink-install options, which affect whether builds start from scratch or reuse previous artifacts.
Selective Build and Test Commands
Colcon provides fine-grained control over which packages to process:
--packages-select: Build only the specified packages.--packages-up-to: Build a package and all of its dependencies.--packages-above: Build a package and all packages that depend on it. This is crucial for iterative development. Similarly,colcon testruns tests for built packages, with options to select specific packages or rerun failed tests. Test results are aggregated in thelog/directory.
Environment Overlay (Isolated Installs)
A key feature is the creation of an overlayed environment. When you source install/setup.bash, the built packages' libraries, executables, and ROS 2 message definitions are added to your shell's environment, overlaying on top of any system-wide ROS installation. This allows you to develop and test local changes without affecting other workspaces or the system install. The --symlink-install option creates symlinks instead of copying files, enabling instant changes to Python scripts or launch files without a rebuild.
Extensible with Verbose Logging
Colcon is designed for extensibility through plugins and event handlers. Its behavior can be customized for different workflows. It also provides extensive logging:
- Console output can be controlled with verbosity flags (
--event-handlers console_direct+). - Detailed build and test logs are written to timestamped directories within
log/. This is invaluable for debugging complex build failures, as it captures the exact output from CMake, make, and other underlying tools.
How Colcon Works
Colcon is the primary command-line build tool for ROS 2, designed to build multiple interdependent packages within a workspace.
Colcon is a meta-build tool that orchestrates the underlying build systems (like CMake, Python setuptools, or ament) for each package in a workspace. It performs a dependency-aware topological sort to determine the correct build order, then invokes each package's native build process in parallel where possible. The tool aggregates build artifacts into unified install, build, and log directories, providing a consolidated output structure for the entire workspace.
Its operation is driven by a colcon.meta file for workspace-wide configuration and individual package.xml manifests for per-package metadata. Key commands include colcon build for compilation, colcon test for running unit tests, and colcon list to inspect packages. By abstracting the complexities of heterogeneous build systems, Colcon enables developers to manage large, modular robotic codebases with a single, consistent interface.
Colcon vs. Catkin: Build Tool Comparison
A technical comparison of the primary build tools for ROS 2 (Colcon) and ROS 1 (Catkin), focusing on architectural differences, features, and workflow.
| Feature / Metric | Colcon (ROS 2) | Catkin (ROS 1) |
|---|---|---|
Primary Role | Meta-build tool orchestrating underlying build systems (CMake, Python setuptools) | CMake-based build system with custom macros and Python integration |
Core Architecture | Language-agnostic, extensible plugin system for build, test, and other verbs | Tightly integrated CMake workflow with Catkin-specific macros |
Workspace Structure | Supports isolated (--merge-install) and merged install layouts; no devel space | Uses devel space for development builds and install space for final deployment |
Underlying Build System | Delegates to CMake, ament_cmake, Python setuptools, or other colcon-* plugins | Primarily uses its own Catkin CMake macros; limited direct Python package support |
Dependency Management | Processes package dependencies via ament/colcon metadata; parallel builds by default | Processes dependencies via Catkin's CMake macros; sequential builds by default |
Build Isolation | High isolation between packages by default; can build subsets of a workspace | Lower isolation; workspace is typically built as a monolithic unit |
Test Execution | Integrated test verb with support for multiple test runners; results aggregation | Test execution via catkin_make run_tests or catkin_test_results |
Cross-Platform Support | First-class support for Windows, macOS, and Linux | Primarily designed for Linux; limited official support for Windows/macOS |
Extensibility | High via plugins (colcon-* packages) for new build types, linters, etc. | Low; extensions require modifying Catkin's core CMake infrastructure |
Command-Line Interface | Verb-based (colcon build, colcon test, colcon list). Consistent and extensible. | Make-inspired (catkin_make, catkin_make_isolated, catkin build with catkin_tools). |
Real-Time / Production Focus | Designed with production and real-time systems in mind, aligning with ROS 2 goals. | Optimized for the research and prototyping focus of ROS 1. |
Frequently Asked Questions
Colcon is the primary build automation tool for ROS 2 and other ament-based packages. It is the successor to `catkin_make` and `catkin build` from ROS 1. These questions address its core functionality, usage, and integration within the ROS 2 development workflow.
Colcon (Collective Construction) is a command-line tool for building sets of software packages, designed as the primary build system for ROS 2. It works by recursively discovering packages in a workspace, configuring their dependencies, and invoking their underlying native build systems—such as CMake for C++ packages or Python setuptools for Python packages—in the correct topological order. It aggregates the output (build, install, log directories) from all packages into centralized locations, providing a unified interface for compiling, testing, and installing complex, interdependent software stacks like ROS 2.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Colcon operates within a larger ecosystem of ROS 2 build and packaging tools. These related concepts define the structure, dependencies, and lifecycle of the software it compiles.
ROS 2 Workspace
A ROS 2 workspace is a directory structure where source code for ROS packages is placed, built, and installed. It is the primary context for the colcon build tool. A typical workspace contains:
- A
srcdirectory containing package source code. build,install, andlogdirectories created bycolconafter a build.
Colcon builds all packages within a workspace, respecting their inter-dependencies, and installs the outputs to the install directory, which can then be sourced to make the built packages available to the system.
ROS Package
A ROS package is the fundamental atomic unit of software in ROS, containing nodes, libraries, data files, and configuration. It is the primary target for colcon build. A valid package must contain:
- A
package.xmlfile (the manifest) declaring metadata, dependencies, and export properties. - A
CMakeLists.txtfile (for C/C++) orsetup.py/setup.cfg(for Python) to define the build process.
Colcon discovers all packages in a workspace, parses their manifests to construct a dependency graph, and invokes the appropriate underlying build system (e.g., CMake, setuptools) for each.
Ament Build System
Ament is the core build and metatool system for ROS 2, of which Colcon is the primary user-facing tool. Ament provides the foundational infrastructure that Colcon orchestrates, including:
- Ament CMake: A collection of CMake macros and functions for finding dependencies, installing files, and registering packages.
- Ament Python: The
setuptools-based build system for Python packages. - Ament Index: A resource index in the
installdirectory that allows packages to discover each other's resources (interfaces, launch files, etc.) at runtime.
Colcon is not tied exclusively to Ament but is its default and most integrated build tool.
Underlying Build Systems (CMake, setuptools)
Colcon is a meta-build tool; it does not compile code directly. Instead, it invokes and manages the underlying, language-specific build systems for each package in the correct order. The primary systems are:
- CMake: Used for C and C++ packages. Colcon calls
cmake,make, andmake install(or their Ninja equivalents) for these packages. - setuptools (via
python -m buildorpip): Used for pure Python packages. Colcon invokes the package'ssetup.pyor usespyproject.tomlto build and install the module.
Colcon's role is to manage the workspace-level build process, ensuring dependencies are built first and outputs are aggregated into a unified install space.
Package Dependency Resolution
A core function of Colcon is to resolve and order package dependencies before building. It reads the <depend> and <exec_depend> tags in each package's package.xml manifest to construct a directed acyclic graph (DAG). Colcon then:
- Performs a topological sort to determine the correct build order.
- Ensures build tools (CMake, pkg-config) can find the headers and libraries of already-built dependencies in the workspace's
installdirectory. - Supports both build-time dependencies (required to compile) and execution-time dependencies (required to run). This prevents common build failures due to missing or out-of-order dependencies.
Build Profiles (Debug, Release)
Colcon supports configuring different build profiles or build types, primarily for CMake-based packages, to optimize for development or deployment. Key profiles include:
- Debug: Builds with debug symbols (
-g), no optimization, and often with assertions enabled. Used for development and debugging. - Release: Builds with full optimization (
-O3) and no debug symbols. Used for final deployment to maximize performance. - RelWithDebInfo: A hybrid with optimization and debug symbols.
The profile is typically set via the --cmake-args flag, e.g., --cmake-args -DCMAKE_BUILD_TYPE=Release. This allows developers to easily switch between fast iteration and performance-tuned builds.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us