--- title: "Install and setup" description: "Run the darkgrade CLI with npx or install it globally, check your camera with doctor, and add tab completion and the manual page to your shell." url: https://darkgrade.com/docs/cli/install last_updated: 2026-12-04 docs_index: https://darkgrade.com/docs/llms.txt --- # Install and setup > Run the darkgrade CLI with npx or install it globally, check your camera with doctor, and add tab completion and the manual page to your shell. > ## Documentation Index > Fetch the complete documentation index at: https://darkgrade.com/docs/llms.txt > Use this file to discover all available pages before exploring further. Run `darkgrade`, the Darkgrade CLI, with `npx`, or install it once for a shorter command, tab completion and a manual page. Then `doctor` says whether this computer and your camera are ready. ## Run or install You need [Node.js](https://nodejs.org) 22.18 or newer. - **`npx darkgrade `** when you are trying it, or the machine should not keep an install. - **`npm install -g darkgrade`** when you run it often or from cron, or want tab completion and `man darkgrade`. The docs write `npx darkgrade`. After a global install, drop the `npx`: ```bash npm install -g darkgrade darkgrade --version ``` ```text darkgrade 0.1.0-alpha.1 ``` Your version number will be newer. `darkgrade version --json` adds the Node version and platform, for bug reports: ```json {"version":"0.1.0-alpha.1","node":"24.3.0", "platform":"darwin","architecture":"arm64"} ``` ## Check your setup `doctor` checks four things and says how to fix each one that is not right. ```bash npx darkgrade doctor ``` ```text darkgrade 0.1.0-alpha.1 ✓ Node 24.3.0 on darwin arm64 ✓ Settings in ~/.darkgrade; sharing is on ✓ USB driver loaded ✓ ILCE-7M5 (054c:0f51) is ready Everything is in place. Next: darkgrade telemetry benchmark ``` | Check | Passes when | | - | - | | `node` | Node is 22.18 or newer. If not, install a newer Node. | | `settings` | The settings folder (`~/.darkgrade`) can be read and written. If not, make it writable, or point `DARKGRADE_HOME` at a folder that is. | | `usb-driver` | The USB module loads. If not, reinstall `darkgrade` so the module is built for this Node and platform. | | `camera` | A camera is attached and in the USB mode for computer control. If not, follow the [USB mode steps](#put-the-camera-in-the-right-usb-mode) below. | `doctor` exits 1 when a check fails. A missing camera is a warning, not a failure, so it still exits 0. The home folder is printed as `~`, so you can paste the output into a [bug report](https://github.com/darkgrade/darkgrade/issues). For scripts, `doctor --json` prints `{ version, healthy, checks }`; see [its shape](https://darkgrade.com/docs/cli/output.md#doctor-and-cameras). `doctor` looks at USB only and never opens the camera. **Ready** means the camera is in the right USB mode, not that nothing else is holding it. ### Put the camera in the right USB mode A camera that is attached but not ready shows as **attached, not in PTP mode**. [PTP](https://darkgrade.com/docs/overview/glossary.md#ptp) is the Picture Transfer Protocol: the USB mode in which a camera accepts control from a computer, rather than acting as a card reader. On a Sony, set **USB Connection Mode** to **PC Remote** (or **Remote Shooting**), not Mass Storage. The menu path differs by model: see [Where the setting is, by model](https://darkgrade.com/docs/cameras/sony.md#where-the-setting-is-by-model). Canon and Nikon usually need nothing: close the brand's own utility (EOS Utility, NX Tether) first. A Canon DSLR with Wi-Fi enabled and a Nikon set to iPhone are the exceptions: see [Canon](https://darkgrade.com/docs/cameras/canon.md#before-you-plug-in-a-canon) and [Nikon](https://darkgrade.com/docs/cameras/nikon.md#before-you-plug-in-a-nikon). [Set up the camera](https://darkgrade.com/docs/slate/getting_started/camera-compatibility.md#set-up-the-camera) has every brand. Use a USB cable that carries data, switch the camera on, then run the command again. [Camera compatibility](https://darkgrade.com/docs/slate/getting_started/camera-compatibility.md) lists which bodies work. ### If a ready camera will not open Only one program can hold a camera's USB connection. Close [Studio](https://darkgrade.com/docs/studio.md) and the maker's own utility (EOS Utility, NX Tether) first. **On a Mac**, the system's own camera service claims a camera when it is plugged in, and a command then fails with an access or busy error ([why](https://darkgrade.com/docs/slate/getting_started/installation.md#prepare-your-computer); [Camera not found and other errors](https://darkgrade.com/docs/overview/errors.md#could-not-claim-the-usb-device) lists every such message with its fix). The CLI does not stop the service for you. Stop it, then run your command straight away, because macOS starts it again: ```bash killall -9 ptpcamerad PTPCamera mscamerad 2> /dev/null npx darkgrade camera get-info ``` [Scripts and automations](https://darkgrade.com/docs/cli/scripting.md) has the line to put before each command in a script. **On Linux**, your user needs permission to open the camera's USB device. [Prepare your computer](https://darkgrade.com/docs/slate/getting_started/installation.md#prepare-your-computer) says how. ## List cameras `cameras` lists what is attached over USB, with each camera's USB id and state. Like `doctor`, it only looks at USB: no camera is opened and no setting is read. ```bash npx darkgrade cameras ``` ```text ILCE-7M5 054c:0f51 ready ``` The id is the USB vendor and product id (`VID:PID`). Pass it to `--camera`, or set `DARKGRADE_CAMERA`, to pick one camera when several are attached: ```bash npx darkgrade camera get-info --camera 054c:0f51 ``` When several are attached and you do not name one, a command uses the only device made by a camera brand it knows. If there is still more than one, it lists them with the exact `--camera` line for each and exits 1. > [!NOTE] > > The id names a model, not one body. Two cameras of the same model share an id, so `--camera` cannot tell them apart. ## Get help in the terminal | Run | To see | | - | - | | `darkgrade` or `darkgrade --help` | Every command | | `darkgrade help camera` | Every camera command | | `darkgrade help camera take-photo` | One command: its inputs, flags and examples | | `darkgrade camera take-photo --help` | The same | | `darkgrade man` | The manual page | A mistyped command or flag is answered with the closest one, and nothing runs on a guess: ```text $ darkgrade camra error: Unknown command "camra". Did you mean "camera"? Usage: darkgrade [options] Run "darkgrade --help" for details. ``` A camera word that is not a command names the command for it: ```text $ darkgrade shoot error: Unknown command "shoot". Use "darkgrade camera take-photo". Usage: darkgrade [options] Run "darkgrade --help" for details. ``` ## Tab completion `completions` prints a script for bash, zsh or fish that completes commands and flags when you press Tab. Save it where your shell loads completions: ```bash zsh mkdir -p ~/.zfunc darkgrade completions zsh > ~/.zfunc/_darkgrade # In ~/.zshrc, before compinit: # fpath=(~/.zfunc $fpath) ``` ```bash bash darkgrade completions bash \ > ~/.local/share/bash-completion/completions/darkgrade ``` ```bash fish darkgrade completions fish \ > ~/.config/fish/completions/darkgrade.fish ``` Open a new shell to load it. Completion is for the `darkgrade` command, so it needs the global install. ## The manual page A global install registers the manual page, so `man darkgrade` works. `darkgrade man` opens the same page, and works with `npx` too. Piped, it prints the page's roff source: ```bash darkgrade man > darkgrade.1 ``` The manual lists every command, the [environment variables](https://darkgrade.com/docs/cli/output.md#environment-variables) and the exit statuses. ## Still stuck? [Get help](https://darkgrade.com/docs/overview/help.md#what-to-include) says where to ask and what to send. ## Next > [card] [Quickstart](https://darkgrade.com/docs/cli.md) > > Read a setting, change it and take a photo. > [card] [Benchmark and sharing](https://darkgrade.com/docs/cli/telemetry.md) > > Test everything your camera supports, and choose what is shared.