Vcpkg: How do I install vcpkg?

Created on 22 Jul 2019  ·  2Comments  ·  Source: microsoft/vcpkg

I’ve followed installation guide very carefully, bootstrap-vcpkg.bat printed many pages of text at the end it printed “Building vcpkg.exe... done.”
Yet, when I type vcpkg search at the command prompt, I’m, getting error:

'vcpkg' is not recognized as an internal or external command, operable program or batch file.

Do I need to keep the source code repository to use vcpkg, or did the installation script copied it somewhere so it can be safely removed? If later, where? Different Microsoft’s blog posts say different locations, c:\vcpkg\installed or C:\Dev\vcpkg but I have neither of them created, does it mean the installer script has failed?

How do I integrate vcpkg in path?

I don’t like keeping executable files writeable by non-elevated processes. Can I move vcpkg.exe to program files and update NTFS permissions accordingly? Will it still work? How does it search for data files i.e. libraries/repository, does it keep data under %userprofile% according to MS recommendations?

Do you have an MSI that installs the software? Or at least a complete installation guide which works and compatible with the current version of vcpkg?

Thanks in advance.

question

Most helpful comment

Hi @Const-me

Thanks for giving vcpkg a try!

After running bootstrap-vcpkg.bat the vcpkg executable is built and dropped in the root of the vcpkg folder.

The executable is not added to PATH nor are any files copied to a different location, there is no actual "install" process, the bootstraping process just builds vcpkg.exe.

Everything you need to use vcpkg is inside the folder in which you cloned it,
if you ever want to uninstall vcpkg just delete the project folder.

To use vcpkg from the command line, run "./vcpkg " from the folder containing vcpkg.exe.

You can add the folder containing vcpkg.exe to your PATH variable manually, and then you will be able to do vcpkg <any command>.

Do I need to keep the source code repository to use vcpkg?

Yes, the project folder contains not only vcpkg's source code, but also:

  • a number of CMake scripts needed to run vcpkg in <vcpkg>/scripts and <vcpkg>/triplets,
  • library ports, the recipes to build each library, in <vcpkg>/ports,
  • the libraries you install <vcpkg>/installed,
  • downloaded libraries' source code <vcpkg>/buildtrees,
  • and downloaded utilites in <vcpkg>/downloads.

You can think of this folder as an environment that will be maintained by vcpkg, all of vcpkg's operations are performed within these directories (even if you invoke it from a different directory in the command line).

When you want to update vcpkg just run these commands:

git pull origin master
./bootstrap-vcpkg.bat

This will update your library ports [1] and get the latest vcpkg source code, it is a good practice to bootstrap (rebuild) vcpkg each time you update to new sources.

Installing libraries usually entails a great number of file generating, copying, moving and deleting operations, so I don't recommend cloning vcpkg in a restricted location.

[1] git pull updates the port recipes, but does not actually modify your installed libraries.
To update your installed libraries you need to run:
vcpkg update
vcpkg upgrade --no-dry-run

All 2 comments

Hi @Const-me

Thanks for giving vcpkg a try!

After running bootstrap-vcpkg.bat the vcpkg executable is built and dropped in the root of the vcpkg folder.

The executable is not added to PATH nor are any files copied to a different location, there is no actual "install" process, the bootstraping process just builds vcpkg.exe.

Everything you need to use vcpkg is inside the folder in which you cloned it,
if you ever want to uninstall vcpkg just delete the project folder.

To use vcpkg from the command line, run "./vcpkg " from the folder containing vcpkg.exe.

You can add the folder containing vcpkg.exe to your PATH variable manually, and then you will be able to do vcpkg <any command>.

Do I need to keep the source code repository to use vcpkg?

Yes, the project folder contains not only vcpkg's source code, but also:

  • a number of CMake scripts needed to run vcpkg in <vcpkg>/scripts and <vcpkg>/triplets,
  • library ports, the recipes to build each library, in <vcpkg>/ports,
  • the libraries you install <vcpkg>/installed,
  • downloaded libraries' source code <vcpkg>/buildtrees,
  • and downloaded utilites in <vcpkg>/downloads.

You can think of this folder as an environment that will be maintained by vcpkg, all of vcpkg's operations are performed within these directories (even if you invoke it from a different directory in the command line).

When you want to update vcpkg just run these commands:

git pull origin master
./bootstrap-vcpkg.bat

This will update your library ports [1] and get the latest vcpkg source code, it is a good practice to bootstrap (rebuild) vcpkg each time you update to new sources.

Installing libraries usually entails a great number of file generating, copying, moving and deleting operations, so I don't recommend cloning vcpkg in a restricted location.

[1] git pull updates the port recipes, but does not actually modify your installed libraries.
To update your installed libraries you need to run:
vcpkg update
vcpkg upgrade --no-dry-run

@Const-me I tried running the file as you did but I keep getting an error message. Can you walk me through it?

Was this page helpful?
5 / 5 - 1 ratings