rubocop command not found

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

Introduction

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

rubocop: command not found

or when using sudo you get the following error message

sudo: rubocop: command not found

Solutions to rubocop: command not found

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

In Ubuntu rubocop is provided by rubocop package.

rubocop is:

rubocop is a static code analyzer for Ruby, out of the box it will enforce many of the guidelines outlined in the community Ruby Style Guide.

Most aspects of its behavior can be tweaked via various configuration options.

Apart from reporting problems in your code, RuboCop can also automatically fix some of the problems for you.

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

sudo apt-get -y install rubocop

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

You can also use apt command to install rubocop.

sudo apt -y install rubocop

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

sudo aptitude install rubocop

Summary

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