ROS: Which environment variables does install/setup.sh actually modify?

When running install/setup.sh or install/local_setup.sh in ROS2, you might wonder which environment variables are actually modified.

The exact variables might depend on the project in use. For this example we’ll use franka_description.

When using either setup.sh or local_setup.sh, the following variables are modified:

Method

cd franka_description
colcon build
printenv > a.env
source install/setup.sh
printenv > b.env

Now we can diff the files:

diff a.env b.env

Example output

The output is identical for setup.sh and local_setup.sh in this case:

76,77c76,77
< AMENT_PREFIX_PATH=/opt/ros/jazzy
< CMAKE_PREFIX_PATH=/opt/ros/jazzy/opt/gz_math_vendor:/opt/ros/jazzy/opt/gz_utils_vendor:/opt/ros/jazzy/opt/gz_cmake_vendor
---
> AMENT_PREFIX_PATH=/home/user/franka_description/install/franka_description:/opt/ros/jazzy
> CMAKE_PREFIX_PATH=/home/user/franka_description/install/franka_description:/opt/ros/jazzy/opt/gz_math_vendor:/opt/ros/jazzy/opt/gz_utils_vendor:/opt/ros/jazzy/opt/gz_cmake_vendor
81a82
> COLCON_PREFIX_PATH=/home/user/franka_description/install