Upfront PS: This only applies to ROS1.
Sometimes your ROS workspace is messed up and no longer working as expected. Maybe because of over-tinkering or you just can’t find what’s wrong or whatever. You just want to reset and restore the workspace to “factory settings”.
Here’s how to do it. Let’s assume the following (if not, just adjust accordingly):
- You named your workspace
- You created the workspace at
- IMPORTANT DISCLAIMER: backup any files or folders you don’t want to lose, as all files or folders will be cleaned out.
- Run the following commands from a terminal:
rm -rf /home/user/catkin_ws/src/ rm -rf /home/user/catkin_ws/build/ rm -rf /home/user/catkin_ws/devel/ mkdir -p /home/user/catkin_ws/src/ cd /home/user/catkin_ws/ catkin_make
And that’s it! Don’t forget to substitute
/home/user/catkin_ws/ with the actual path to your workspace, if different.
Questions and comments are welcome.