Skip to content

Manager

We will manage our software environment using the Software Environment Manager pkgx.
In addition to managing software packages, pkgx makes it easy to manage environment variables on a per-project basis (non-hierarchical).

Prerequisites

Install the sudo command if it is not already available (e.g. when working inside a container).

# (command -v sudo) || (apt update && apt -y install sudo)

Install the curl command if it is not already available.

$ (command -v curl) || ( sudo apt update && sudo apt -y install curl )

pkgx

Installation

Install the pkgx command.

~ $ curl https://pkgx.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3485  100  3485    0     0   9146      0 --:--:-- --:--:-- --:--:--  9171
installing: /usr/local/bin/pkgx
######################################################################## 100.0%
pkgx 2.7.0
pkgm 0.11.1
mash 0.4.0
now type: pkgx --help
~ $ pkgx --help
usage:
  pkgx [+pkg@x.y…] <program|path> [--] [arg…]

examples:
  $ pkgx gum format "# hello world" "sup?"
  $ pkgx node@18 --eval 'console.log("hello world")'
  $ pkgx +openssl cargo build

modes:
  $ pkgx --query bun  # could you run `bun`? (-Q)
  $ pkgx --help       # hi mom!
  $ pkgx --version

flags:
  -q,  --quiet      # suppress brief informational messages
  -qq, --silent     # no chat. no errors. just execute.
  -j,  --json=v2    # output JSON (if sensible)
  -C,  --chdir <d>  # change directory first
  --sync            # sync first (note: rarely if ever needed)
  -v                # print version and continue

more:
  $ xdg-open https://docs.pkgx.sh

Integration

Integrate pkgx with your shell.

~ $ pkgx integrate
/Users/david_delavennat/.zshrc << `source <(pkgx --shellcode)`
/Users/david_delavennat/.bashrc << `eval "$(pkgx --shellcode)"`
/Users/david_delavennat/.bash_profile << `eval "$(pkgx --shellcode)"`
restart your terminal for `pkgx` hooks to take effect

Install it with pkgx.

~/tp/ $ pkgx install github.com/mikefarah/yq
pkgx: installed: ~/.local/bin/yq

Usage

To use the development environment defined in a pkgx.yaml file, you must first run the dev command.