Skip to content

How to use the OpenStack CLI tools on Mac OS X

Estimated time to read: 4 minutes

This tutorial describes how to use the OpenStack Command Line Interface (CLI) tools on Mac OS X. For example, you will learn how to list your instances and volumes by using the CLI. You will also learn how you can launch a new instance by using the CLI.


For this tutorial you’ll need the following:

  1. A Fuga Cloud account
  2. A device running Mac OS X

In case you’re running Windows or Linux, please check out the following guides:

Step 1 - Installing Python 3

If you want to use the Dockerfile (explained in step 3), you can omit this step.

The OpenStack command line tools need Python and Python on OS X is utterly broken, but fortunately, you can install your own, up-to-date version.

To install homebrew use the following command lines:

$ /usr/bin/ruby -e "$(curl -fsSL"
Using brew to install Python3"
$ brew install python

Install a stable Python binary from downloads

Installing the OpenStack command line tools

Now Python3 is installed you can install the OpenStack command line tools:

$ pip3 install python-openstackclient

Step 2 - Install the configuration file

Now, follow the steps below to install the configuration files:

  1. Log in to the Fuga Cloud Dashboard
  2. Then go to the Access tab
  3. Here you can create OpenStack API Credentials (Remember to save the password in a safe place)
  4. Now you can choose to download one of three files (Dockerfile, OpenRC, Clouds.yaml). These files contain all necessary configurations for the clients.

save this file to the folder where your project resides

Build the Docker container

$ docker build -t openstackcli --build-arg OS_PASSWORD=<$PASSWORD> - < <$PROJECT_DIR>/Dockerfile
Where <$PASSWORD> is used fill in the password of your OpenStack API Credentials and instead of <$PROJECT_DIR> you fill the directory where your project resides on your disk.

Run the interactive CLI

$ docker run -it --rm openstackcli
--rm openstackcli removes the container when you close it. This way your system doesn’t get cluttered with unused containers. You can check this with:
$ docker ps --all
If you want to exit the environment, use:
$ exit

Save this file to the folder where your project resides. <$CLOUD_NAME> is the name of the cloud specified on line 2 in the clouds.yaml file. By default this is fuga.

List your instances

$ openstack --os-cloud <$CLOUD_NAME> server list
List your volumes
$ openstack --os-cloud <$CLOUD_NAME> volume list
List the images
$ openstack --os-cloud <$CLOUD_NAME> image list

  1. Save this file to the folder on the machine where you have installed the OpenStack CLI clients.
  2. Go to the location where you have saved the file.
  3. Run the following command:
  4. Enter your OpenStack API Credentials password

Step 3 - Using the Fuga CLI

You have now installed and configured the OpenStack CLI client and can start using the Fuga CLI. The following are some examples you can try. You can also call OpenStack help for all available commands. For more in-depth information, check out OpenStack command-line clients.

Interactive mode

If you only enter the command OpenStack, you enter interactive mode. This mode lets you interact faster with the Fuga CLI.

While in interactive mode, you don’t have to use the OpenStack command on every single command line. For example:

$ openstack server list
In interactive mode just bij using the $ openstack command.
$ server list
While in interactive mode enter help to get all the different commands. If you only need to find a specific command enter:
$ help | grep "<your command>"
For instance:
$ help | grep list
This will return all list commands.

If you want to exit the environment, use

$ exit 

Step 4 - Creating a new server with CLI

First, you need to create a new key. You can name it, for example, test_cli_key or use an existing key.

Creating a key with the CLI can be done the following command:

$ openstack keypair create test_cli_key
This command returns the newly generated private key. Store this somewhere safe.

Now test if the key is created:

$ openstack keypair list
Next up is to list the images and flavors you can choose from:
$ openstack image list
$ openstack flavor list
The example below shows you a c2.small instance, named CLI-Test and running Ubuntu 18.04 LTS using the newly generated key.
$ openstack server create --image b88f311a-b5f6-49d0-ad44-5304f9a8ef9b --flavor c2.small --key-name test_cli_key CLI-test
After a few seconds, the server is created and built.

Step 5 - Exiting the environment

Deactivating the virtualenv

When you’re done with the virtualenv, run deactivate. You’ll see your prompt revert to normal.

Reactivating the virtualenv

Anytime you want to run your virtual environment, activate the “fugaio” virtualenv as shown in step 3. This will put you into the appropriate virtualenv with all the necessary modules and dependencies. When you’re done, simply deactivate it again.

Using the clouds.yaml file

Unless you’re in a virtualenv, you don’t have to do anything.

Using the Dockerfile

Press Ctrl-D or type exit in the active terminal to exit Interactive mode.


In this tutorial, you’ve learned how to use the OpenStack Command Line Interface tool on Mac OS X. You leared how to list your instance and volumes using this tool. Besides this, you also learned how to launch a new instance by using the CLI.

More tutorials about using the Command Line Interface can be found here.