Install or uninstall the Slack CLI for Windows

Developing automations requires a Business+ or Enterprise Grid plan. Don't have one? Join the Developer Program and provision a sandbox with access to all Slack features for free.

The Slack CLI is a set of tools critical to building workflow apps. This is your one-stop shop for those tools.

✨ If you've not used the Slack CLI before, we recommend following our quickstart guide instead. We'll still get your wagon loaded up before you depart for the trail, but we'll also give you some additional guidance.

‡️ If you need to authorize the Slack CLI, go here.

Installing the Slack CLI for Windows

The minimum required Slack CLI version for Enterprise Grid as of September 19th, 2023 is v2.9.0. If you attempt to log in with an older version, you'll receive a cli_update_required error from the Slack API. Run slack upgrade to get the latest version.

PowerShell is required for installing the Slack CLI on Windows machines. An alternative shell will not work.

Run the automated installer from Windows PowerShell:

irm https://downloads.slack-edge.com/slack-cli/install-windows.ps1 | iex

PowerShell is required for installing the Slack CLI on Windows machines; an alternative shell will not work.

This will install the Slack CLI and all required dependencies, including Deno, the runtime environment for workflow apps. If you have VSCode installed, the VSCode Deno extension will be installed.

Optional: Use an alias for the Slack CLI binary

If you have another CLI tool in your path called slack, you can rename the slack binary to a different name before you add it to your path.

To do this, copy the Slack CLI into any folder that is already in your path, or add a new folder to your path by listing the folder you installed the Slack CLI to in your Environment Variables. You may not have access to edit System variables, so you might need to add it to your account's User variables. You can open the Environment Variables dialog by pressing the Win+R keys to open the Run window, and then entering the following command:

rundll32.exe sysdm.cpl,EditEnvironmentVariables

You can also use the -Alias flag as decribed within Optional: customize installation using flags.


Optional: customize installation using flags

There are several flags available to customize the installation. Since flags cannot be passed to remote scripts, you must first download the installation script to a local file:

irm https://downloads.slack-edge.com/slack-cli/install-windows.ps1 -outfile 'install-windows.ps1'

The available flags are:

Flag What it does Example
-Alias Installs the Slack CLI as the provided alias -Alias slackcli will create a binary named slackcli.exe and add it to your path
-Version Installs a specific version of the Slack CLI -Version 2.1.0 installs version 2.1.0 of the Slack CLI
-SkipGit If true, will not attempt to install Git when Git is not present -SkipGit $true
-SkipDeno If true, will not attempt to install Deno when Deno is not present -SkipDeno $true

You can also see all available flags by passing -? to the installation script:

.\install-windows.ps1 -?

Here's an example invocation using every flag:

.\install-windows.ps1 -Version 2.1.0 -Alias slackcli -SkipGit $true -SkipDeno $true

Troubleshooting

Errors

Error: Not working? You may need to update your session's Language Mode.

Solution: For the installer to work correctly, your PowerShell session's language mode will need to be set to FullLanguage. To check your session's language mode, run the following in your PowerShell window: ps $ExecutionContext.SessionState.LanguageMode. To run the installer, your session's language mode will need to be FullLanguage. If it's not, you can set your session's language mode to FullLanguage with the following command: ps $ExecutionContext.SessionState.LanguageMode = "FullLanguage"

1. Download and install Deno. Refer to Install Deno for more details.

2. Verify that Deno is installed and in your path.

The minimum version of Deno runtime required for developing workflow apps is currently at version 1.37.0.

$ deno --version
deno 1.31.1* (release, x86_64-apple-darwin)
v8 10.*
typescript 4.*

3. Download and install Git, a dependency of the slack CLI.

4. Download the slack CLI installer for your environment.

Β  Windows (.zip)

5. Add the slack CLI to your path.

Existing slack binary in path?

If you have another CLI tool in your path called slack, we recommend renaming our slack binary to a different name before adding it to your path. See the Automated installation tab for more details.

6. Verify that slack is installed and in your path:

$ slack version
Using slack v2.29.2

7. Verify that all dependencies have been installed.

Run the following command:

$ slack doctor

A few notes about hooks

If you have upgraded your CLI version but your deno-slack-hooks version is less than v1.3.0, when running slack doctor, you will see the following near the end of the output:

βœ” Configurations (your project's CLI settings)
    Project ID: 1a2b3c4d-ef5g-67hi-8j9k1l2m3n4o
                
✘ Runtime (foundations for the application)
    Error: The `doctor` hook was not found (sdk_hook_not_found)
    Suggestion: Ensure this hook is implemented in your `slack.json`

βœ” Dependencies (requisites for development)
    deno_slack_hooks: 1.2.3 β†’ 1.3.0 (supported version)

In addition, if you attempt to run the slack run command without this dependency installed, you will see a similar error in your console:

🚫 The `start` script was not found (sdk_hook_not_found)

πŸ’‘ Suggestion
    Hook scripts are defined in the Slack configuration file ('slack.json').
    Every app requires a 'slack.json' file and you can find a working example at:
    https://github.com/slack-samples/deno-starter-template/blob/main/slack.json

Ensure that deno-slack-hooks is installed at the project level and that the version is not less than v1.3.0.

8. Install the VSCode extension for Deno (recommended).


Installing PowerShell

Run the following command to install PowerShell 7 on your machine:

iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"

The following articles may also be helpful should you run into any issues:


Uninstalling the Slack CLI

All good things come to an end! If you need to uninstall the Slack CLI, run the commands below. Note that these commands will uninstall the Slack CLI, but not its dependencies. Follow these instructions to uninstall Deno.

✨ Just need to uninstall an app? Refer to uninstall an app from your workspace.

Run the following commands in PowerShell

The command binary is stored in $HOME\AppData\Local\slack-cli or $HOME\.slack-cli. This binary can be removed with the following command:

rd -r $HOME\AppData\Local\slack-cli

where $HOME is substituted for the full path, e.g. C:\Users\<your_username>.

As with installation, PowerShell is required for uninstallation of the Slack CLI from Windows machines. An alternative shell will not work.

Removing the command from the $env:path can be done with the following command:

$env:Path = ($env:Path -split ';' -ne Β "$HOME\AppData\Local\slack-cli\bin") -join ';'

Removing the command from the system path can be done with the following command:

[System.Environment]::SetEnvironmentVariable('Path', (([System.Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::User) -split ';' -ne '$HOME\AppData\Local\slack-cli\bin') -join ';'), [System.EnvironmentVariableTarget]::User)

Finally, general configurations can be removed with the following command:

rd -r $HOME\.slack

To check that uninstallation was successful, run the following commands and verify that you receive an error β€” in this case, that's a good thing!

slack version
echo $env:path

Until next time!


Have 2 minutes to provide some feedback?

We'd love to hear about your experience building Slack automations. Please complete our short survey so we can use your feedback to improve.