Install the Grey Matter CLI
This guide will help you install and set up the Grey Matter CLI.

The Grey Matter Command Line Interface (CLI) is a configuration tool for Grey Matter. Leveraging the Grey Matter Control API, the CLI mainly performs dynamic configuration of the Fabric mesh.
Q: How do the CLI and the Grey Matter Control API interact?
A: The CLI manipulates configuration objects registered with the control plane to control the behavior of the sidecars making up the mesh. Learn more about these mesh objects if you haven't already.
Prerequisites
To complete this tutorial, you’ll need an understanding of, and local access to the following environments and tools:
Unix Shell (or equivalent)
Step 1: Download and Install the greymatter
CLI
greymatter
CLIThe greymatter
CLI is a binary written in Go. There are two ways to install it:
use
gmenv
, a manager for installing and setting differentgreymatter
versionsdownload the binary manually from our release pages
We recommend using gmenv
because it allows for easier versioning against different Grey Matter environments.
Option A (recommended): Use gmenv
gmenv
Install gmenv using homebrew or manually following the README
Configure it with your Grey Matter credentials (the email and password used to access Grey Matter's Nexus Repository). For ease of use, it is recommended to use a credentials file.
Run
gmenv install 1.4.2
to install the latest version of the CLI. You should see:Installation of greymatter v1.4.2 successful. To make this your default version, run 'gmenv use 1.4.2'
Run
gmenv use 1.4.2
to set this as your version.Switching default version to v1.4.2 Switching completed
Option B: Install the greymatter
binary manually
greymatter
binary manuallyRetrieve the latest release directly or visit Grey Matter's Nexus Repository to browse all released versions of the CLI. When prompted, enter the username and password associated with your Grey Matter account.
Alternatively, any artifact in nexus can also be downloaded with a terminal. The below command demonstrates how to do this with curl
. Before executing, replace -u user.name@organization.com
with your username, and make sure the desired artifact is specified.
curl https://nexus.greymatter.io/repository/raw/release/gm-cli/greymatter-v1.4.2.tar.gz -u user.name@organization.com > greymatter-v1.4.2.tar.gz
greymatter
is distributed as a precompiled binary. Once you have downloaded the desired release, install it with the following steps:
Unpack the tarball
tar -xvzf greymatter-v1.4.2.tar.gz
You will see the binaries:
x ./greymatter.linux x ./greymatter.exe x ./greymatter.osx ...
Move the
greymatter
binary for your operator onto your system'sPATH
with namegreymatter
:sudo mv ./greymatter.linux /usr/bin/greymatter
On a Mac?
On a Mac there is SIP mode which won't let you move the binary into your $PATH. Follow these instructions to disable rootless mode:
Reboot into recovery mode (reboot and hold down Cmd-R)
Open a terminal
Use this command:
csrutil disable
Reboot and run the command that worked prior to El Capitan
When you're done, it is highly recommended that you re-enable SIP by following the same steps, but using
csrutil enable
in step 3.
Make sure to rename your binary for your operating system to just greymatter
when moving the artifact into your $PATH
Step 2: Test Installation
Run a quick test of the binary with the following command to verify a successful installation.
$ greymatter --version
Grey Matter CLI
Command Name: greymatter
Version: v1.4.2
Branch: release-1.4
Commit: 455e5fc
Built: Wed, 08 Jul 2020 18:47:07 UTC by justincely
Grey Matter Control API
Version: v1.4.2-dev
If you don't see this response, verify that the greymatter
binary is on your PATH
.
Step 3: Configure Your Environment for Grey Matter
Once the CLI has been downloaded and installed, it will need to be configured for your Grey Matter installation to communicate with the Grey Matter Control API. If you don't yet have an existing Grey Matter installation, get started with the Quickstart Installation Guide, and you will be able to configure the Grey Matter CLI and complete step 4 once it is up.
If you have an existing deployment running, configure the CLI by setting the following environment variables in your terminal. Note that as each deployment is different, the specific endpoint and security context will be different, so make sure to verify your settings against the deployed environment.
export GREYMATTER_API_HOST=services.greymatter.io:443
export GREYMATTER_API_PREFIX=/services/control-api/latest
export GREYMATTER_API_SSL=true
export GREYMATTER_API_INSECURE=true
export GREYMATTER_API_SSLCERT=/path/to/my.crt
export GREYMATTER_API_SSLKEY=/path/to/my.key
export EDITOR=vim # or your preferred editor
It is recommended to use an absolute path for your GREYMATTER_API_SSLCERT
and GREYMATTER_API_SSLKEY
variables.
NOTE: If you've used our quickstart guide - see the configure the CLI section for the specific configurations.
The full configuration and usage of the CLI can be found in the support pages or by running greymatter --help
, but some quick examples are shown here.
Configuration options can also be set by CLI flags with each use. These flags will take precedence over the set environment variables.
greymatter create --api.host=services.greymatter.io:443 --api.prefix=/services/control-api/latest --api.ssl=true route < route.json
Step 4: Test connection to the Grey Matter Control API
This section requires a running instance of the Grey Matter Control API server. Your GREYMATTER_API_HOST
and many other configuration options will change based upon where the Control API service is deployed.
List Zone
Use greymatter list zone
with the following keys and certs to connect to the Grey Matter Control API.
$ greymatter list zone
[
{
"zone_key": "zone-default-zone",
"name": "default-zone",
"checksum": "6883b95eb2dbd05e15c54fcd0e5414bcb5a6aee1d3b91ab2d1c6493e4945ff74"
}
]
The returned Zone
indicates that the connection was successful, and you've been able to inspect the Fabric Mesh. You can now interact with your Grey Matter installation using the CLI!
If you see a connection refused error, your configuration is likely wrong. Check the values you have configured by running greymatter
with no command, the options configured from the environment will be listed at the bottom of the output.
Questions?
Need help with your installation?
Create an account at Grey Matter Support to reach our team.
Last updated
Was this helpful?