Install Ruff on Ubuntu 24.04

Install Ruff on Ubuntu 24.04

Ruff is a fast Python linter and code formatter designed to improve code quality and consistency. Developed with performance in mind, Ruff provides a comprehensive set of linting rules and checks for common Python issues. It can be integrated into various development workflows, such as CI/CD pipelines, to automate the process of identifying and fixing code issues. This tutorial shows how to install Ruff on Ubuntu 24.04.

Install Ruff

Get the current version of Ruff from its GitHub repository:

RUFF_VERSION=$(curl -s "" | grep -Po '"tag_name": "v\K[0-9.]+')

Download Ruff according to the version obtained earlier:

wget -qO ruff.tar.gz$RUFF_VERSION-x86_64-unknown-linux-gnu.tar.gz

Extract the executable to the /usr/local/bin directory:

sudo tar xf ruff.tar.gz -C /usr/local/bin ruff

We can verify the Ruff version using the command:

ruff --version

Delete the unnecessary downloaded file:

rm -rf ruff.tar.gz

Testing Ruff

Create a simple Python file for testing:

printf "import sys\nimport pprint\nprint(sys.path)" >

To run Ruff as a linter, execute the following command:

ruff check

Output: F401 [*] `pprint` imported but unused
Found 1 error.
[*] 1 fixable with the `--fix` option.

To use Ruff as a formatter, run this command:

ruff format


1 file reformatted

Uninstall Ruff

To uninstall Ruff, eliminate the relevant file:

sudo rm -rf /usr/local/bin/ruff

Leave a Comment

Cancel reply

Your email address will not be published.