Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I work on two different projects that use the two different versions, and I'd like to switch at will between them.

When I try to install package 'libxerces-c-dev' it wants to uninstall 'libxerces-c2-dev'.

How would I set up the two side-by-side using update-alternatives?

share|improve this question
up vote 1 down vote accepted

This is what I did;

  • used synaptic to install xerces-2 packages
  • cd /usr/include
  • sudo cp -rp xercesc xercesc-28
  • used synaptic to install xerces-3 packages
  • cd /usr/include
  • sudo mv xercesc xercesc-31
  • sudo ln -s xercesc-31 xercesc

The above creates two key sym links; /usr/lib/, and /usr/include/xercesc. Now to configure update-alternatives to manage those two links for me;

sudo update-alternatives --install /usr/lib/ libxerces /usr/lib/ 1 --slave /usr/include/xercesc xerces-dev /usr/include/xercesc-28

sudo update-alternatives --install /usr/lib/ libxerces /usr/lib/ 2 --slave /usr/include/xercesc xerces-dev /usr/include/xercesc-31

This allows me to select between the two libxerces alternatives, and slaves the xerces-dev selection to that choice, as well. So, now I can switch between the two using;

  • sudo update-alternatives --config libxerces

update-alternatives presents a text menu, which I don't really need because I know the option numbers from the '--install' commands. To quickly bypass that, I added these to my ~/.bashrc

  • alias x28='echo "1" | sudo update-alternatives --config libxerces > /dev/null'
  • alias x31='echo "2" | sudo update-alternatives --config libxerces > /dev/null'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.