The pkgx is a command-line package manager that provides portable runtime environments. It allows software tools and programming languages to be installed and executed without manually managing system dependencies. This tutorial demonstrates how to install pkgx on Ubuntu 26.04.
Install pkgx
Retrieve the newest release tag for pkgx and assign it to a variable:
PKGX_VERSION=$(curl -s "https://api.github.com/repos/pkgxdev/pkgx/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')
Download the latest release archive from GitHub and extract the executable into the system path:
curl -sSL https://github.com/pkgxdev/pkgx/releases/latest/download/pkgx-${PKGX_VERSION}+linux+x86-64.tar.gz \
| sudo tar xz -C /usr/local/bin pkgx
After the executable has been installed, verify the pkgx version to confirm that the command is available:
pkgx --version
Testing pkgx
Create a simple JavaScript file to check that pkgx can run a development environment correctly:
echo "console.log('Hello world');" > test.js
Execute the script using the Node.js runtime provided through pkgx:
pkgx node test.js
Output:
Hello world
The successful execution confirms that pkgx can download and use the required runtime automatically.
Uninstall pkgx
If pkgx is no longer needed, remove the executable from the system:
sudo rm -rf /usr/local/bin/pkgx
Delete the pkgx directories and cached files:
rm -rf ~/.pkgx ~/.cache/pkgx ~/.local/share/pkgx
Leave a Comment
Cancel reply