--- title: "Kandji Agent Command Line Interface" slug: "kandji-agent-command-line-interface" updated: 2025-07-22T17:04:20Z published: 2025-07-22T17:04:20Z canonical: "support.kandji.io/kandji-agent-command-line-interface" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.kandji.io/kb/llms.txt > Use this file to discover all available pages before exploring further. # Kandji Agent Command Line Interface The Kandji Agent offers a suite of powerful Terminal commands that give admins additional control and information for their fleet of devices. While some commands can only be executed locally on a device using Terminal, others can be deployed through a Custom Script Library Item for greater flexibility. ### Local-Only Commands The following commands must be executed directly on a device in Terminal. They cannot be deployed via a Custom Script or a Custom App Library Item. #### Run The agent will run and check in immediately. Normally, the agent checks in every 15 minutes. Without an internet connection, the agent will run in offline mode. ```bash sudo kandji run ``` Adding --reset-daily to the run command will run all Parameters, including those that are run only once per day. ```bash sudo kandji run --reset-daily ``` #### Run Daily MDM Inventory Update The agent will request the MDM server to initiate its daily MDM commands, such as validating Apps & Books from Apple Business Manager, as well as querying certain device information. ```bash sudo kandji update-mdm ``` #### Collect Apps Collects full application inventory from the Mac. ```bash sudo kandji collect-apps ``` #### Run Library Items Checks for library items to execute. ```bash sudo kandji library ``` Available *library* command options: | **Option** | **Description** | | --- | --- | | `--list` | List all of the library items assigned to the computer. | | `--state` | Get the current state of the Kandji Agent library manager. | | `--item` | Run a specific library item by name or library item ID; specify *-F* to force the execution. | | `--cancel` | Cancel the currently running library item and clears the current queue. | #### Print Kandji Logs Prints log entries for the Kandji Agent subsystem from the unified logging system. The `--last` option is **required** and specifies the number of previous seconds to print logs from. Replace with a number, like 300. (Actual results displayed are limited based on available unified log storage.) Redirect the output of the command using > to save to an external log file. ```bash sudo kandji logs --last ``` Available *logs* command options: | **Option** | **Description** | | --- | --- | | `--no-format` | Print log entries without ANSI color formatting. | | `--debug` | Includes debug level logs, debug logging must be enabled prior. | Enable debug logging for a subsystem, which are listed in the Logging Subsystems section. ```bash sudo log config --mode "level:debug" --subsystem io.kandji.installer ``` Example debug logging command usage. ```bash sudo kandji logs --no-format --debug --last 10000 >~/Desktop/kandji.log ``` **Logging Subsystems** The logging subsystems available in the Kandji Agent offer granular and targeted logging. Subsystem predicate log command. ```bash sudo log show --predicate 'subsystem beginsWith "io.kandji"' ``` Available predicate log command options: | **Option** | **Description** | | --- | --- | | `--info` | Includes info level logs when available. | | `--debug` | Includes debug level logs, debug logging must be enabled prior. | | `--help` | Displays a complete list of available options. | Subsystem predicate log command with options. ```bash sudo log show --predicate 'subsystem beginsWith "io.kandji.daemon"' --info --debug ``` Available logging subsystems: - io.kandji.beekeeper - io.kandji.cli - io.kandji.daemon - io.kandji.installer - io.kandji.library-manager - io.kandji.menu - io.kandji.passport - io.kandji.parameter-agent - io.kandji.self-service - io.kandji.liftoff #### Avert List quarantined files. ```bash sudo kandji avert --list-quarantine ``` Delete quarantined files. ```bash sudo kandji avert --delete-quarantine ``` ### Scriptable Commands These commands can be executed through a Custom Script or a Custom App Library Item. They can also be run locally on a Mac in Terminal. > [!WARNING] > When using the scriptable options below, such as within a Custom Script Library Item, you must replace **sudo kandji** with the the full path to the binary: /usr/local/bin/kandji #### Reboot This option can be used in scripted workflows to force a reboot leveraging the Kandji Agent and menu bar application. It is visually similar to the reboot forced during FileVault enablement or a Managed OS upgrade. This initiates a restart by prompting the logged-in user with a countdown timer. If no delay is specified, the default 1800 (30 minutes) will be used. If no user is logged in, the delay will be ignored, and the Mac will restart immediately. ```bash sudo kandji reboot --delaySeconds NumberOfSeconds ``` Forces a restart without giving users the option to delay. ```bash sudo kandji reboot --no-deferral ``` #### Dock This option can be used in scripted workflows to add items to the end of the macOS Dock or remove items from the macOS Dock of the currently logged-in user. The application referred to by the bundle identifier must be in the /Applications folder. Optionally specifying the *--all* option adds the icon to the end of the Dock for all user accounts. ```bash sudo kandji dock [--add bundle identifier] [--remove bundle identifier] [--all] ``` If using multiple options at a time, use a single command, and separate options using quotes and separating spaces, as shown in the example below. ```bash /usr/local/bin/kandji dock --add "com.google.Chrome us.zoom.xos com.tinyspeck.slackmacgap" ``` #### Alert This command can be used in scripted workflows to present an alert to users. ```bash sudo kandji display-alert [--title text] [--message text] [--icon path_to_image] [--suppression-key string] [--help-url url] [--no-wait] ``` It has several options, outlined below. | **Option** | **Description** | **Default if not provided** | | --- | --- | --- | | `--title` | Specifies a custom title for the alert window | "Alert" | | `--message` | Specifies a custom message for the alert window | No default value | | `--icon` | Specifies a custom icon for the alert window. It is recommended to use .jpg, .png, or .icns files | Kandji Agent icon | | `--suppression-key` | If provided, it will show an option to the user: "Do not show this message again" If this suppression key is provided in a future alert, and the user opts not to see it again, the alert will not be shown. | No default value If no suppression key is specified, the "Do not show this message again" option is not displayed. | | `--help-url` | Allows for specifying a custom URL for the alert Help button. Must be an HTTPS URL | No default value If no URL is specified, the Help button is not displayed. | | `--no-wait` | Allows the alert to show but keeps the remainder of the script running without waiting for user interaction on the alert | Alert will show and wait for interaction from the user before the script proceeds. | --- Below is an example of the underlying command for an alert and the resulting experience in macOS Sequoia: ```bash sudo /usr/local/bin/kandji display-alert --title "Low Disk Space" --message "Your Mac computer's Hard Drive is running critically low on space, please contact Accuhive IT as soon as possible." --suppression-key accuhive --help-url https://kandji.io --no-wait ``` ![](https://cdn.document360.io/0844b095-d720-4a7b-bb17-ec97d9bc6e41/Images/Documentation/Kandji-Support-KB-01-02.png) #### Submit Diagnostics [Submit Diagnostics](/v1/docs/how-to-submit-kandji-agent-diagnostics) to Kandji. Equivalent to the action menu (gear) item available in the Kandji Menu. ```bash sudo kandji submit-diagnostics [--comment text] ``` Available submit-diagnostics command option: | **Option** | **Description** | **Default if not provided** | | --- | --- | --- | | `--comment` | Specifies a comment to be presented in the diagnostics | No default value | #### Version Display the installed Kandji Agent version. ```bash sudo kandji version ``` #### Help Display help text. ```bash sudo kandji help ```