How To Install ruby-capture-output on Ubuntu 18.04

In this tutorial we learn how to install ruby-capture-output on Ubuntu 18.04. ruby-capture-output is Ruby library to grab given IO output and return it as a string

Introduction

In this tutorial we learn how to install ruby-capture-output on Ubuntu 18.04.

What is ruby-capture-output

ruby-capture-output is:

Provides Capture.output, Capture.stdout and Capture.stderr methods that can be used to grab output generated by current or spawned process.

This is useful for testing when you need to start a process and check its output or when you need to check current process output.

There are three methods to install ruby-capture-output on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install ruby-capture-output Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install ruby-capture-output using apt-get by running the following command:

sudo apt-get -y install ruby-capture-output

Install ruby-capture-output Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install ruby-capture-output using apt by running the following command:

sudo apt -y install ruby-capture-output

Install ruby-capture-output Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install ruby-capture-output using aptitude by running the following command:

sudo aptitude -y install ruby-capture-output

How To Uninstall ruby-capture-output on Ubuntu 18.04

To uninstall only the ruby-capture-output package we can use the following command:

sudo apt-get remove ruby-capture-output

Uninstall ruby-capture-output And Its Dependencies

To uninstall ruby-capture-output and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove ruby-capture-output

Remove ruby-capture-output Configurations and Data

To remove ruby-capture-output configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge ruby-capture-output

Remove ruby-capture-output configuration, data, and all of its dependencies

We can use the following command to remove ruby-capture-output configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge ruby-capture-output

References

Summary

In this tutorial we learn how to install ruby-capture-output package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.