rspec command not found

In this troubleshooting guide we learn how to fix rspec command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

rspec: command not found

or when using sudo you get the following error message

sudo: rspec: command not found

Solutions to rspec: command not found

How To Fix rspec: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu rspec is provided by ruby-rspec-core package.

ruby-rspec-core is:

RSpec is a Behaviour Driven Development framework for Ruby. It provides a framework for writing and executing examples of how your Ruby application should behave.

This package provides the core of the RSpec framework.

To fix this problem, we can install more using the command below.

sudo apt-get -y install ruby-rspec-core

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install ruby-rspec-core.

sudo apt -y install ruby-rspec-core

Or if you have aptitude installed you can use the following command.

sudo aptitude install ruby-rspec-core

Summary

In this tutorial we learn how to fix rspec command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.