Install or uninstall the Slack CLI for Mac and Linux

Developing automations requires a paid 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 Mac and Linux

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.

Run the automated installer from your terminal window:

curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash

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, pass the -s argument to the installer script:

curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash -s <your-preferred-alias>

The alias you use should come after any flags used in the installation script. For example, if you use both flags noted below to pass a version and skip the Deno installation, your install script might look like this:

curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash -s -- -v 2.1.0 -d <your-preferred-alias>

You can also copy the Slack CLI into any folder that is already in your path (such as /usr/local/binβ€”you can useecho $PATH to find these), or add a new folder to your path by listing the folder you installed the Slack CLI to in /etc/paths.

If you don't rename the slack binary to a different name, the installation script will detect existing binaries named slack and bail if it finds oneβ€”it will not overwrite your existing slack binary.


Optional: customize installation using flags

There are two optional flags available to customize the installation.

  1. Specify a version you'd like to install using the version flag, -v. The absence of this flag will ensure the latest Slack CLI version is installed.
curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash -s -- -v 2.1.0
  1. Skip the Deno installation by using the -d flag, like this:
curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash -s -- -d

Troubleshooting

Errors

Error: Failed to create a symbolic link! The installer doesn't have write access to /usr/local/bin. Please check permission and try again...

Solution: Sudo actions within the scripts were removed so as not to create any security concerns. The $HOME env var is updated to /root β€” however, the installer is using $HOME for both Deno and the SDK install, which causes the whole install to be placed under /root, making both Deno and the SDK unusuable for users without root permissions.

  • For users who do not have root permissions, run the sudo actions manually as follows:
    sudo mkdir -p -m 775 /usr/local/bin, then sudo ln -sf "$slack_cli_bin_path" "/usr/local/bin/$SLACK_CLI_NAME" where $slack_cli_bin_path is typically $HOME/.slack/bin/slack and $SLACK_CLI_NAME is typically the alias (by default it’s slack).
  • For users who do have root permissions, you can run the installation script as sudo curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash. In this case, the script is executed as root.

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.

Β  Download for macOS (.tar.gz)

Β  Download for Linux (.tar.gz)

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.31.0

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).



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 instructions 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 your terminal window

$ rm -rf ~/.slack  # Delete the download binary
$ rm /usr/local/bin/slack  # Delete the command alias (replacing `slack` with a command name)

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.

Build something social for your team on Slack
πŸƒβ€β™€οΈ Customize our Running Buddies tutorial for your favorite activities