Getting Started
Last updated
Last updated
With pkgx
it couldn’t be simpler to run anything from the Open Source
ecosystem:
Generally you don’t need to search since you already know what you want to run, so just type it! Sometimes though you want to browse.
We have a web based package listing at. This is the most thorough resource at this time.
And from the CLI you can use query mode:
pkgx foo
runs the latest “foo” that is installed.
If you want to ensure the latest version of “foo” is installed, usepkgx mash pkgx/upgrade foo
.
It can be useful to run a program with additional packages in the environment.
Here +pkg
syntax added OpenSSL to Cargo’s environment. Thus the build will see
the OpenSSL headers and libraries.
In some cases pkgx foo
may be ambiguous because multiple packages providefoo
.
In such cases pkgx
will error and ask you be more specific by using
fully-qualified-names:
In general it's a good idea to specify fully qualified names in scripts, etc. since you want these to work forever.
It can be useful to run system commands with a package environment injected. To do this either specify the full path of the system executable:
Or separate your commands with --
:
If you only specified make
rather than /usr/bin/make
or separating with-- make
then pkgx
would install GNU make for you and use that.
If you don’t specify anything to run, pkgx
will install any +pkg
s and then
dump the environment:
This can be useful in scripts or for adding tools to your shell:
For this mode we can also output JSON: pkgx +gum --json
.
Note that this only effects pkgx
not the tools you run with pkgx
.
In some cases you don’t want to use a pkgx
package if the user has that
package already installed to their system. For these cases we provide anensure
script:
You can set PKGX_DIR
to have pkgx
install packages there. This can be useful
for creating “virtual environments” for various usages.
pkgx
is not a package manager. Thus the command itself doesn’t typically offer
such operations you may expect, however the way pkgx
works is simple and
standardized so we offer some mash
scripts to help.
Longer term we will make a tool pkgq
to help with these operations.
pkgx foo
executes the latest version of foo
that is downloaded. To ensure
you have (any) newer versions installed use this command:
The pkgx
download cache can get large over time. To prune older versions:
This may delete versions that you use—if so—this is fine. pkgx
will just
reinstall them next time you need them.
ie. what versions could be run by pkgx
:
Generally you probably want @
syntax, but if you need more specificity we
fully support :