Packit is a universal package manager, designed to streamline the experience of installing packages on your system.
Please note Packit is still in early development, breaking changes are possible in future versions.
You might be asking yourself: why use this new package manager when I already have one? As mentioned before, Packit is a universal package manager that works on macOS, Linux and native Windows (no subsystem for Linux required!). Its interface and usage remain consistent across all platforms, making it ideal for developers who frequently switch between operating systems. In addition to being a universal package manager Packit also offers some unique features:
- Active versions, which allows multiple package versions to be installed next to each other without conflict.
- Flexible dependency resolution, each package dependency can be satisfied with any satisfying package, instead of requiring a single fixed version.
- (Un)linked packages, which allows a package to be installed, but not in the PATH to avoid conflicts with existing packages when necessary.
- Portable repositories which can be used to create repositories for offline or air-gapped systems.
Packit can be installed by simply copying one of the commands below in your terminal.
After install you need to make sure you add the Packit prefix directory to your PATH, to ensure the pit command is available in your terminal. The command for this is shown after the install script finished installing.
curl -fsSL https://raw.githubusercontent.com/pack-it/packit/main/install.sh | sh
curl -fsSL https://raw.githubusercontent.com/pack-it/packit/main/install.bat --output packit-install.bat && call packit-install.bat
You can also build Packit from source locally, by simply using Cargo. Please note that Rust needs link.exe on Windows, which is part of the Visual C++ toolchain.
- First download the provided source code or clone the Git repository.
- Open the terminal inside the source folder and run
cargo build-install. Usecargo build-install --destination=<DESTINATION>to use a different destination than the default. - After building and installing, there will be a
target/builddirectory (or the destination you specified in the command) which contains thebindirectory, containing thepackitbinary (packit.exeon Windows).
If you only need the packit binary itself, you could build it directly using cargo build, or cargo build --release for a release build. This will result in the packit binary (packit.exe on Windows) which will be located at target/debug/packit or at target/release/packit for a release build.
To install and initialize your locally built version of Packit, you need to:
- Move the build destination directory (
target/build) to<prefix>/packages/packit/<version>. - Run
<prefix>/packages/packit/<version>/packit init. If you used another prefix than the default prefix, you need to specify your prefix in the--prefixflag to this command. - Add
<prefix>/binto your PATH. Thepitcommand should now be available and working. You can test this usingpit list, this should only show Packit as installed package.
The Packit repository is licensed under the GNU General Public License v3.0. See LICENSE for the full license.
The general usage of Packit is: pit <COMMAND>.
pit install <PACKAGE-NAME>[@<VERSION>] ... [--build] [--build-all] [--keep-build] [--skip-symlinking] [--skip-active] [--verbose] [--skip-test] [--skip-build-test] [--pause-build]
Installs the specified packages, if a version is given that version will be installed, if not the latest available version will be installed. Multiple packages can be specified by entering multiple names, split by a space.
If the --build option is given, the package is build from source, instead of installing a prebuild version.
If the --build-all option is given, the package and all its dependencies are build from source, instead of installing prebuild versions.
If the --keep-build option is given, the build dependencies will not be deleted after building.
If the --skip-symlinking option is enabled, the package is not symlinked into the /bin, /lib, /share, etc. directories.
If the --skip-active option is enabled, the package is not set to active and the current active version is kept. If there is no current active version, this flag is ignored and the package is set to active.
If the --skip-test option is enabled, Packit tests are skipped.
If the --skip-build-test option is enabled, build tests are skipped.
If the --verbose option is given, extra verbose output is shown, like build output.
If the --pause-build option is enabed, the build is paused after build script execution to debug builds.
Uninstalls the specified packages, if a version is given that version will be uninstalled, if not, you will be asked if you want to delete all versions of <PACKAGE-NAME> in case there are multiple versions installed. Multiple packages can be specified by entering multiple names, split by a space.
Lists all the installed packages. If the --updatables flag is specified, all updatable packages are listed. If the --active flag is specified, only the active package versions are listed.
Searches a package with <QUERY>. If --regex is not enabled, the query is expected to be <PACKAGE-NAME>[@<VERSION>] and information based on the package metadata is shown, if the version is given that specific version is searched for. If --regex is given, all packages that match the given regular expression query are shown. The --verbose flag can be used to show more output. The --tree flag can be used to show the tree of a package. Note that the package version also needs to be given in this case and that the latest version is assumed for the dependencies. The --latest flag can be used to use the latest version of a specified package, instead of specifying a version. If the --target-only flag is enabled with the --regex flag, only the packages that are available for the current target are shown.
pit update [<PACKAGE-NAME>[@<VERSION>] ...] [--new-version <NEW-VERSION>] [--all] [--exclude <PACKAGE-NAME> ...]
Updates the specified package to the new version, or the latest version if no new version is specified. If multiple packages are specified they are all updated to the latest version (and --new-version cannot be used). If multiple versions of the same package are installed, the latest installed version is assumed. The --new-version flag can be used to specify the new version to install. The --all flag can be used to update all packages (the latest installed version will be updated). The --exclude flag can be used to exclude certain packages when using the --all flag.
Shows info about the specified installed package. If the -v option is given, extra information is shown. If the --tree option is enabled, the whole dependency tree is shown. If no arguments are given, information about the current Packit install is shown. The --active flag can be used to use the active version of a specified package, instead of specifying a version.
Checks the Packit installation for issues. When package name(s) and version(s) are given, only those package(s) are checked for issues.
Fix all issues found by the check command. You will be asked if you want to fix an issue for each issue type. When package name(s) and version(s) are given, only those package(s) are checked and fixed.
Switches the active version of the specified package to the specified version. If the --skip-symlinking option is given, the new active version is not symlinked into the /bin, /lib, /share, etc. directories.
Switches the dependency version of the specified package to the specified version.
Links the specified package into the /bin, /lib, /share, etc. directories. If the package metadata does not allow a package to be symlinked, the --force option is required to force the symlinking of the package. Please be careful with using the --force option, since there is most likely a good reason to skip symlinking. The --overwrite option can be used to overwrite existing symlinks from another package, please note that this should normally not be used, as conflicts between packages should be avoided.
Unlinks the specified package, causing the package to be unavailable from the PATH environment variable.
Packages the specified package(s) into a prebuild and stores it in the destination directory, together with a checksum of the prebuild. When --structured is used the packages will be put into a prebuild directory structure. --all will package all installed packages.
Calculates the checksum of the file at the given url. Also shows the size of the downloaded file in bytes.
pit util portable-repo <DESTINATION> <PACKAGE-NAME>@<VERSION> ... [--exclude-prebuilds] [--skip-dependency-resolution]
Generates a portable repository at the given destination, containing the specified packages. Normally all dependencies of the packages are added automatically, when the --skip-dependency-resolution flag is given, this step is skipped. If the --exclude-prebuilds flag is given, prebuilds are not included in the portable repository and are not required for the generation.
Checks the metadata from the given repository. The <REPOSITORY> argument can be a URL or a path to the repository or a repository id specified in Config.toml. If a package name is given only that package and the given repository are checked. If no package name is given all packages specified in the index.toml from the repository are checked.
Shows the current configuration.
Sets the prefix to the given directory. Currently not supported when there are already installed packages.
Sets the multiuser setting to true or false. Currently not supported when there are already installed packages.
Lists all configured repositories.
Sets the repositories rank in the config. Multiple <REPOSITORY-ID> can be given for multiple repositories in the rank.
Adds a new repository to the config. Also adds the new repository to the back of the repositories rank. If the --unchecked flag is given, the new repository is not checked for availability and compatibility.
Removes a repository from the config. Also removes the repository from the repositories rank.
Sets the url of a repository in the config. If no provider is given, the old provider is used. If the --unchecked flag is given, the new repository is not checked for availability and compatibility.
Sets the prebuilds url of a repository in the config. If no provider is given, the old provider is used.
Disables or enables the prebuilds url of a repository in the config. If the --remove-urls flag is given, the urls are removed if <VALUE> is true.
Initializes the Packit environment by setting up all required files and directories. If the --prefix option is given, the given path is used as prefix, instead of the default prefix.
All available fields in the config are listed below. The pit config command can also be used to change the config.
| Field | Explanation |
|---|---|
prefix_directory |
Defines the directory used for installing packages, see File structure for the defaults on each platform. |
repositories_rank |
Defines the order of repositories to search for a package. |
multiuser |
True to run Packit in multiuser mode, false for single user mode. |
| Field | Explanation |
|---|---|
url |
Defines the url to the repository. |
provider |
Defines the provider of the repository, defaults to web. |
prebuilds_url |
Defines the url of the prebuilds repository for this package repository. |
prebuilds_provider |
Defines the provider of the prebuilds repository, defaults to fs. |
disable_prebuilds |
True to disable prebuild usage for the repository, false to use prebuild if available. |
Specifying a prebuild repository is optional and overrides the value specified in the repository metadata.
repositories_rank = ["core"]
[repositories]
[repositories.core]
provider = "web"
url = "https://raw.githubusercontent.com/pack-it/core/main/"
You might be interested in how (and why) Packit manages dependencies, configs and most importantly the installs. We explain that here, ofcourse this differs a bit for each platform as they have different file structures. Luckly Packit manages this for you!
The prefix directory of Packit contains all data of installed packages.
On Unix systems we use /opt/packit, on Windows we use C:\Program Files\packit
All installed packages will go in <prefix>/packages/<PACKAGE-NAME>/<PACKAGE-VERSION>/.
The Register.toml file is located inside the prefix and stores information about all installed packages. This file is managed by Packit and should not be changed directly.
The currently active version of a package will be symlinked in <prefix>/active/<PACKAGE-NAME>. This will link to <prefix>/packages/<PACKAGE-NAME>/<ACTIVE-PACKAGE-VERSION>
The active binaries will be symlinked in: <prefix>/bin/<EXECUTABLE-NAME>. This directory needs to be present in the users PATH in order for installed binaries to be detected by the system.
On Linux we use /etc/packit for the configs, on macOS we use /Library/Application Support/packit and on Windows we use C:\Program Files\packit.
Currently the only config is Config.toml, containing all configured repositories.
See the docs directory for more detailed documentation of Packit.