Set up a machine in one command

pratique-connect is a small command-line tool for developer machines. It signs you in through the browser, gives the machine its own token, and sets up every package manager it finds. One command replaces the per-tool steps on the next pages.

bashmacOS and Linux
curl -fsSL https://pratique.example.com/connect/install.sh | sh

Use your Pratique server's address. The Connect page shows this command with the address filled in. The script downloads the tool for your system into ~/.local/bin, then runs pratique-connect login. Set PRATIQUE_BIN to install it somewhere else.

On Windows, download pratique-connect-windows-amd64.exe from the link on the Connect page and run pratique-connect login https://pratique.example.com.

Where the tool comes from

Your Pratique server hands out the tool itself, at /connect/download/. The Docker image contains builds for macOS, Linux and Windows, on Intel and ARM. You need no other download site, and the tool always has the same version as your server. It is about 6 MB and has no dependencies.

SystemFile
macOS, Apple siliconpratique-connect-darwin-arm64
macOS, Intelpratique-connect-darwin-amd64
Linuxpratique-connect-linux-amd64, pratique-connect-linux-arm64
Windowspratique-connect-windows-amd64.exe, pratique-connect-windows-arm64.exe

A server built from source serves the files in PRATIQUE_CLIENTS_DIR. Without it, the download links return 404. See settings reference.

Sign in

pratique-connect login prints a short code and an address:

textterminal
Open https://pratique.example.com/connect/device and enter this code:

    KLKS-SRPL

Waiting for you to approve it...
  1. Open the address in any browser, on any device. Sign in the usual way, with single sign-on, LDAP or the admin token.
  2. Type the code. Lowercase and a missing dash are accepted.
  3. Pratique shows the name of the machine that asked, its address and when it asked. Select Approve only if you started the sign-in yourself and your terminal shows the same code.

The tool then collects its token and sets up your tools. Because the browser does not need to reach your machine, this also works in an SSH session, on a remote server or in a container.

Codes from someone else

A code gives a token in your name to whoever started the sign-in. Never approve a code that someone sent you. If you did not start it, select Refuse.

Codes last 10 minutes and work once. Looking at a code creates nothing; only Approve creates the token.

The token it gets

  • A personal token, named connect: and the machine's host name, on your Access tokens page.
  • It expires after 90 days. Run pratique-connect login again to renew it; the tool remembers the server.
  • It cannot publish packages. For publishing, create a token on the Access tokens page.
  • Downloads with it show in Activity as your email address and the token name.
  • A new login replaces the machine's earlier token and revokes it.

Without a browser sign-in

A server where people sign in only with the admin token can still use the tool. Create a token on the Access tokens page and pass it on standard input:

bashuse an existing token
pratique-connect login https://pratique.example.com --token-stdin < token.txt

What it changes

The tool changes only your user settings, never a project's files. It keeps everything else in each file, writes each file in one step, and gives the same result when you run it again. It skips tools that are not installed; run pratique-connect login again after you install one.

ToolSettingWhere the token goes
npm, pnpm, Yarn 1, Bunregistry in ~/.npmrc, or the file in NPM_CONFIG_USERCONFIGThe _authToken line in the same file
pipglobal.index-url, set with pip config --user~/.netrc
uvA marked [[index]] block in ~/.config/uv/uv.toml~/.netrc
GoGOPROXY, set with go env -w~/.netrc
ComposerThe global pratique repository, and Packagist turned offauth.json in Composer's home directory
Yarn 2 and laternpmRegistryServer in a marked block of ~/.yarnrc.ymlnpmAuthToken in the same block
  • Files that hold the token can be read only by you (mode 600). npm, Go and Composer read tokens only from files, so the tool does not use the system keychain.
  • ~/.netrc gets one line per server name: with the port for Go, and without it for pip and uv. On Windows the file is _netrc. NETRC sets another path.
  • If ~/.netrc already has an entry for the server that spans several lines, the tool stops and changes nothing. Remove that entry and run it again.
  • Go sends the token only over HTTPS. See Go.

Yarn 2 and later do not read .npmrc, so the tool writes its own block in ~/.yarnrc.yml. If that file already sets npmRegistryServer or npmAuthToken, the tool stops and changes nothing; remove them and run it again. A project's own .yarnrc.yml still wins, and doctor reports it.

Poetry has no global package source, so it is not set up. Add Pratique to each project, as pip, uv and Poetry shows. doctor prints the command.

The tool checks everything before it changes anything, and records your earlier settings first. If a step fails, it revokes the new token; run pratique-connect logout to put back what it changed.

Plain http:// addresses are refused, except on the machine itself, so a token never crosses a network unencrypted.

Check the setup

bashcheck every tool
pratique-connect doctor
textexample output
ok   token     signed in to https://pratique.example.com as alice@example.com (connect: laptop), expires in 83 days
ok   npm       registry is https://pratique.example.com/npm/
ok   pip       index is https://pratique.example.com/pypi/simple/
FIX  go        GOPROXY is https://proxy.golang.org,direct

doctor asks each installed tool for the setting it really uses. An environment variable or a project file that overrides your user settings therefore shows as FIX. It also reports:

  • a token that the server refuses, or that expires within 7 days
  • a tool older than the server; run pratique-connect update
  • PIP_INDEX_URL, UV_INDEX_URL or UV_DEFAULT_INDEX set to another index
  • Yarn 2 or later pointing somewhere else, often because of a project's .yarnrc.yml
  • Poetry, which needs setup per project

doctor exits with code 1 when a line says FIX, so device management can run it on a schedule.

See the connection

bashshow the server, the person and the tools
pratique-connect status

Shows the server, who the token belongs to, when it expires, the versions of the tool and the server, and which tools were set up.

Update the tool

bashinstall the server's current build
pratique-connect update

Downloads the build for your system from the server and replaces the tool. It checks that the download is a program before it replaces anything. doctor tells you when your tool is older than the server. Running the install command again also works.

Undo it

bashrevoke the token and restore the settings
pratique-connect logout

logout revokes the token on the server, removes it from every file, and puts back the registry, index-url and GOPROXY values you had before. It deletes the files that login created, once nothing of yours is in them. Composer's Packagist is turned back on only if it was on before you signed in.

A machine connects to one server at a time. To switch servers, run logout, then login with the new address.

Commands

CommandWhat it does
login [server]Signs in through the browser and sets up every installed tool. Without a server, uses the one this machine is connected to, which renews the token.
login server --token-stdinUses a token from standard input instead of the browser.
doctorChecks that each installed tool uses Pratique and that the token works.
logoutRevokes the token and restores the earlier settings.
statusShows the server, the person, the token's expiry, the versions and the tools that were set up.
update [server]Replaces the tool with the server's current build.
versionPrints the tool's version.
helpPrints the commands.

What it does not do

The tool sets up your tools, but it cannot stop someone from going around Pratique, for example with npm install --registry=https://registry.npmjs.org/. To make Pratique the only way out, block or redirect the public registries at your network edge. See enforce it.

A capture agent for laptops is planned. It will send traffic for the public registry names to Pratique, whatever a tool's settings, which covers machines off the company network. Until then, use your network edge or your web gateway.