Back to Moon

install

website/docs/proto/commands/install.mdx

2.5.34.0 KB
Original Source

import VersionLabel from '@site/src/components/Docs/VersionLabel';

The proto install (or proto i) command can be used to install one or many tools.

Installing all tools<VersionLabel version="0.39.0" />

The proto install command (without arguments) will download and install all tools and plugins from all parent .prototools configuration files, and any versions detected in the current working directory (if not defined in .prototools).

shell
$ proto install

By default, this command does not install tools for versions pinned in the global ~/.proto/.prototools file. Pass --config-mode all to include them.

Installing one tool

The proto install <tool> [version] command will download and install a single tool by unpacking their archive to ~/.proto/tools/<tool>. If the tool has already been installed, the command will exit early.

The command is also smart enough to resolve partial versions, so 1, 1.2, and 1.2.3 are all acceptable. It even supports aliases when applicable, like latest, next, beta, etc. To install a canary release, use canary.

shell
$ proto install deno
$ proto install deno 1.31
$ proto install deno canary

When a version is not provided, it is detected using the same rules as proto run and shims. This honors the detect-strategy setting, the PROTO_<TOOL>_VERSION environment variable, and traverses the configuration file chain, instead of only scanning the current working directory. <VersionLabel version="0.61.0" />

Pinning the version

By default this command will only install the tool into ~/.proto/tools but will not make the binary available. If you would like to also pin the resolved version to a .prototools file, use the --pin option.

shell
# ./.prototools
$ proto install bun --pin
$ proto install bun --pin local

# ~/.proto/.prototools
$ proto install bun --pin global

# ~/.prototools
$ proto install bun --pin user

Immutable lockfiles<VersionLabel version="0.61.0" />

When a lockfile is in use, the --immutable-lockfile option (or the PROTO_IMMUTABLE_LOCKFILE environment variable) treats it as read-only. Versions are resolved from existing records only, and the lockfile is never created, updated, or pruned. If a tool being installed has no matching record, the install fails, which is ideal for reproducible installs in CI.

shell
$ proto install --immutable-lockfile

This option cannot be combined with --update-lockfile or --pin.

Pruning orphaned records<VersionLabel version="0.61.0" />

After a successful install, proto will remove orphaned records from the lockfiles it loaded — records whose tool is still configured, but whose requirement no longer matches the configuration. Records for ad-hoc installs are never pruned.

Handling plugin hooks

Some tools run post-install hooks that support arbitrary arguments that can be passed after --.

shell
$ proto install go -- --no-gobin

Arguments

  • One tool
    • [tool] - Type of tool.
    • [version] - Version of tool. Defaults to a pinned version in .prototools or "latest".
    • [-- <args>] - Additional arguments to pass to post-install hooks.

Options

  • --force - Force install, even if already installed.
  • --immutable-lockfile - Error if the lockfile is missing a record or would be modified. Also supports the PROTO_IMMUTABLE_LOCKFILE environment variable. <VersionLabel version="0.61.0" />
  • --update-lockfile - Don't inherit a version from the lockfile and update the existing record. <VersionLabel version="0.51.0" />
  • One tool
    • --build - Build from source if available. <VersionLabel version="0.45.0" />
    • --no-build - Download a pre-built if available. <VersionLabel version="0.45.0" />
    • --pin - Pin the resolved version and create a symlink in ~/.proto/bin. Accepts a boolean (pins locally by default), or the string "global", or the string "local".