Home » How-To » How to install vcpkg on Ubuntu

How to install vcpkg on Ubuntu

vcpkg is a C and C++ package manager to acquire and manage libraries.

You can download over 1,500 open-source libraries or add your own private libraries.

It’s maintained by the Microsoft C++ team and open-source contributors.

In this guide, you’ll learn how to install vcpkg on Ubuntu, test it, and uninstall it.

How to install vcpkg on Ubuntu

To install vcpkg on Ubuntu, you need to prepare the environment and install vcpkg from the GitHub repository.

Step 1: Prepare the environment

sudo apt update
sudo apt install -y zip unzip

Step 2: Install build-essential and pkg-config packages

sudo apt install -y build-essential pkg-config

Step 3: Install vcpkg from GitHub

wget -O vcpkg.tar.gz https://github.com/microsoft/vcpkg/archive/master.tar.gz

Step 4: Make a new directory to hold vcpkg and extract the tar.gz file

sudo mkdir /opt/vcpkg
sudo tar xf vcpkg.tar.gz --strip-components=1 -C /opt/vcpkg

Step 5: Build vcpkg

sudo /opt/vcpkg/bootstrap-vcpkg.sh

Step 6: Make a symbolic link to the vcpkg command in “/usr/local/bin”

sudo ln -s /opt/vcpkg/vcpkg /usr/local/bin/vcpkg

Step 7: Check the version of vcpkg

vcpkg version

Step 8: Remove the tar.gz file

rm -rf vcpkg.tar.gz

How to test vcpkg on Ubuntu

To test vcpkg on Ubuntu, you need to install the zlib library and get a list of installed libraries by running two separate commands.

1. Install the zlib library

sudo vcpkg install zlib:x64-linux

2. Get a list of installed libraries

sudo vcpkg list

How to uninstall vcpkg on Ubuntu

To completely uninstall vcpkg on Ubuntu, you need to delete the vcpkg installation directory, delete the symbolic link, clear the cache and related directories, and uninstall the related packages and dependencies.

1. Delete the vcpkg installation directory

sudo rm -rf /opt/vcpkg

2. Delete the symbolic link

sudo rm -rf /usr/local/bin/vcpkg

3. Clear the cache and related directories

sudo rm -rf /root/.cache/vcpkg
sudo rm -rf /root/.vcpkg
rm -rf ~/.vcpkg

4. Uninstall related packages and dependencies

sudo apt purge --autoremove -y zip unzip build-essential cpp make binutils pkg-config

Further reading

How to install GCC 11 on Ubuntu

How to install jq on Ubuntu


About the author

Lim How Wei

Lim How Wei is the founder of followchain.org, with 8+ years of experience in Social Media Marketing and 4+ years of experience as an active investor in stocks and cryptocurrencies. He has researched, tested, and written thousands of articles ranging from social media platforms to messaging apps.

Lim has been quoted and referenced by major publications and media companies like WikiHow, Fast Company, HuffPost, Vice, New York Post, The Conversation, and many others. One of his articles about the gig economy was quoted by Joe Rogan who hosts The Joe Rogan Experience (arguably the most popular podcast in the world), in the This Past Weekend podcast by Theo Von.

In his free time, Lim plays multiple games like Genshin Impact, League of Legends, Counter-Strike, Hearthstone, RuneScape, and many others. He creates guides, walkthroughs, solutions, and more on games that he plays to help other players with their progression.