Skip to content

Instantly share code, notes, and snippets.

@vaibhaw
Created October 15, 2016 14:41
Show Gist options
  • Save vaibhaw/4b366684eddb3d58615ad55c07f902f1 to your computer and use it in GitHub Desktop.
Save vaibhaw/4b366684eddb3d58615ad55c07f902f1 to your computer and use it in GitHub Desktop.
Update Alternatives
# source: http://askubuntu.com/a/26518/258167
x=4.8 # priority = 10
y=5 # priority = 20
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
sudo update-alternatives --install /usr/bin/gcc gcc "/usr/bin/gcc-${x}" 10
sudo update-alternatives --install /usr/bin/gcc gcc "/usr/bin/gcc-${y}" 20
sudo update-alternatives --install /usr/bin/g++ g++ "/usr/bin/g++-${x}" 10
sudo update-alternatives --install /usr/bin/g++ g++ "/usr/bin/g++-${y}" 20
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment