ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Removing catkin workspace

asked 2013-06-26 05:53:39 -0500

plunder gravatar image

updated 2013-06-26 17:29:38 -0500

I've created 2 catkin workspaces, then I decided to rm -rf one of them. It seems like there should be a better way to remove it because some environment variables are lingering around with that path, namely $CMAKE_PREFIX_PATH.

  1. Where does ROS set $CMAKE_PREFIX_PATH so I can remove any references to it now that I've deleted it?

  2. Is there a proper way to delete a catkin workspace so that all environmental variables are cleaned up?

Answer: I 'sourced' both my devel workspace 'setup.bash' and the groovy installation 'setup.bash', when I removed that line from my .bashrc (as the commenter said) CMAKE_PREFIX_PATH was no longer set.

Deleting build and develop and simply calling catkin_make again, then sourcing my workspace only in .bashrc fixed it.

Thank you! :D

edit retag flag offensive close merge delete


If the problem persists after a reboot, the problem is probably in your ~/.bashrc. Can you post the contents of that file?

lindzey gravatar image lindzey  ( 2013-06-26 06:32:47 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-06-26 06:15:19 -0500

joq gravatar image

updated 2013-06-26 06:59:59 -0500

This stuff can get very confusing and cause serious errors.

The general recommendation when switching workspaces is always to open a new shell, and source the relevant setup.bash. For catkin, that is normally in devel/ subdirectory.

UPDATE: If you are sourcing the correct setup.bash in your ~/.bashrc and creating a new shell (or rebooting) does not work, there must have been something wrong when you originally created your workspace. The usual error is having forgetten to source the appropriate lower-level setup.bash before running catkin_make.

That is an easy mistake to make. When I find myself in that situation, I do one of these recovery procedures:

  • Create a new workspace, more carefully this time.
  • Delete everything but the src/ subdirectory, source the correct dependency, then re-run catkin_make or catkin_init_workspace.

There may be other solutions, but I find that hacking around in the various generated files just creates frustration and wastes time.

edit flag offensive delete link more


Well, I've already done that but when I reboot the the CMAKE_PREFIX_PATH persists, I'd really like to clean that up, do you know how?

plunder gravatar image plunder  ( 2013-06-26 06:20:34 -0500 )edit

I you have a CMAKE_PREFIX_PATH after reboot then you are setting it in your ~/.bashrc most likely. Look in that file to see if you are source'ing any setup.bash files. If you are, delete or comment that line out and open a new terminal. Rebooting is not necessary, just open a new terminal.

William gravatar image William  ( 2013-06-26 07:17:12 -0500 )edit

I am sourcing 2 files in my .bashrc, 1 is /opt/ros/groovy/setup.bash the other is my current catkin_workspace ~/ros_ws/devel/setup.bash.. I'll try removing these when I get home and see if this solves my issue

plunder gravatar image plunder  ( 2013-06-26 07:47:30 -0500 )edit

If things were set up correctly, the workspace should source /opt/ros/groovy/ for you.

joq gravatar image joq  ( 2013-06-26 07:50:30 -0500 )edit

answered 2018-11-01 03:28:43 -0500

hayaalsh gravatar image

For those using catkin tools, an easy solution is: catkin clean --deinit at the directory of your workspace.

edit flag offensive delete link more

Question Tools


Asked: 2013-06-26 05:53:39 -0500

Seen: 24,548 times

Last updated: Jun 26 '13