I have installed vcpkg, a package manager for C++. Now after some time, I'd like to update it. How can I do that? Do I need to uninstall and reinstall?
Asked
Active
Viewed 9,780 times
6
-
Did you download a zip of the repo or did you clone it? – Alexander Neumann Jan 07 '21 at 08:58
-
I cloned it with git bash – Song Yang Jan 08 '21 at 14:44
-
Did you ask the same question as a issue on vcpkg? https://github.com/microsoft/vcpkg/issues/15417 – Alexander Neumann Jan 13 '21 at 20:56
-
Yes, I did for a better chance of getting an answer – Song Yang Jan 14 '21 at 22:47
3 Answers
8
The best way to update a vcpkg git clone is to do
- save a list of all installed ports somewhere
git pull
- delete the
<vcpkg_root>/installed/
directory - rerun
bootstrap.bat
orbootstrap.sh
- reinstall all ports:triplets you need
Note:
- there is a
vcpkg upgrade/update
command but it is discouraged since it is not transactional - in general you don't need to run re integrate but sometimes it is necessary
vcpkg integrate remove/install

Alexander Neumann
- 1,479
- 8
- 17
3
Given the previous/sufficient answers, this might be a tad redundant, but I usually go in this order (on my Windows machine)
- Open PowerShell, go to the vcpkg root directory and run
.\vcpkg --version
to check the version no. You can check the git to see whether there's a more recent version. - To update, stay in the directory and run
git pull https://github.com/microsoft/vcpkg
. This runs git fetch to get files from the remote repository and runs git merge to merge the changes. - Then run
./bootstrap-vcpkg.bat
to update vcpkg

Bobbie E. Ray
- 635
- 7
- 8