How To Install ruby-posix-spawn on Ubuntu 18.04

In this tutorial we learn how to install ruby-posix-spawn on Ubuntu 18.04. ruby-posix-spawn is Ruby Implementation of posix_spawn(2) for faster process spawning

Introduction

In this tutorial we learn how to install ruby-posix-spawn on Ubuntu 18.04.

What is ruby-posix-spawn

ruby-posix-spawn is:

The posix-spawn library aims to implement a subset of the Ruby 1.9 Process::spawn interface in a way that takes advantage of fast process spawning interfaces when available and provides sane fallbacks on systems that do not.

fork(2) calls slow down as the parent process uses more memory due to the need to copy page tables. In many common uses of fork(), where it is followed by one of the exec family of functions to spawn child processes (Kernel#system,IO::popen, Process::spawn, etc.), it’s possible to remove this overhead by using the use of special process spawning interfaces (posix_spawn(), vfork(), etc.)

There are three methods to install ruby-posix-spawn 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-posix-spawn 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-posix-spawn using apt-get by running the following command:

sudo apt-get -y install ruby-posix-spawn

Install ruby-posix-spawn Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install ruby-posix-spawn

Install ruby-posix-spawn 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-posix-spawn using aptitude by running the following command:

sudo aptitude -y install ruby-posix-spawn

How To Uninstall ruby-posix-spawn on Ubuntu 18.04

To uninstall only the ruby-posix-spawn package we can use the following command:

sudo apt-get remove ruby-posix-spawn

Uninstall ruby-posix-spawn And Its Dependencies

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

sudo apt-get -y autoremove ruby-posix-spawn

Remove ruby-posix-spawn Configurations and Data

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

sudo apt-get -y purge ruby-posix-spawn

Remove ruby-posix-spawn configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge ruby-posix-spawn

References

Summary

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