Blog
rex docsrex perl documentationrexfile syntax

Rex Docs: Where to Find Them and How to Run Your First Task

Rex docs explained: where the official Perl Rex manual, CPAN API and guides live, plus a first Rexfile you can run today to start automating servers.

Portrait of Luis Chavez-Mattos
Edited by Luis Chavez-Mattos, Director, Product··RSS

For IT and Engineering

A young man in a backwards cap carries a thick bound manual with loose pages as his body blurs into a long motion streak behind him.

What are the Rex docs and where do they live?

The official Rex docs live at rexify.org/docs. That section holds the FAQ, the Guides, a Rex Book (still a work in progress), and release notes for every version. The API reference, meaning the detailed description of every function Rex gives you, is hosted on MetaCPAN at metacpan.org/release/Rex. Rex is a Perl-based automation framework, so "Rex docs" means those two places together. If you landed here from a search for "rex docs" and ended up somewhere unrelated, the next section explains why.

TL;DR

  • The official Rex documentation is at rexify.org/docs, with the API reference on MetaCPAN.
  • The docs section has four parts: FAQ, Guides, Rex Book, and Release notes.
  • Many search results for "rex docs" are about different products that share the name, such as the rez package manager and a university reporting system.
  • Rex installs from CPAN, and recent versions need Perl 5.14.4 or newer.
  • A Rexfile is a Perl file that defines tasks, and the rex command runs them.
  • Start with the Guides, keep the API page open as a reference, and check the release notes before upgrading.

Why do so many "rex docs" results look wrong?

The name is crowded. Searching "rex docs" returns at least three unrelated things, and it helps to recognize them quickly.

What you seeWhat it actually is
rez.readthedocs.io (pages like "rez.rex", "Building packages", "rez-env")Documentation for rez, a package management tool. It is spelled differently and has nothing to do with Rex automation.
rex.umbc.eduThe REX Report Exchange at UMBC, a university reporting and data warehouse environment. Its documentation covers training modules for report users and developers.
rexify.org and metacpan.org/release/RexThe Rex automation framework. This is the one covered here.

If the page talks about "Rexfile", "tasks", "CPAN", or Perl, you are in the right place. If it talks about rez packages or student reports, you are not.

How is the official Rex documentation organized?

The rexify.org site calls itself "(R)?ex the friendly automation framework." The Docs menu has these parts:

  • FAQ. Short answers to common questions. Good when you have a specific problem.
  • Guides. Task-oriented walkthroughs. This is where most newcomers should spend their time.
  • Rex Book (work in progress). A longer, book-style treatment. It is labeled as unfinished, so expect gaps.
  • Release notes. One page per version, such as the notes for 1.16.1.
  • API. A link out to MetaCPAN, where the module documentation lives.

The site also has a "Get Rex" page for installation and a Support page for getting help. News and events (talks and live streams about Rex) sit on the home page.

Which Rex docs page should I read first?

Read in this order:

  1. Get Rex to install it.
  2. Guides for a first walkthrough of tasks and a Rexfile.
  3. FAQ when something fails or confuses you.
  4. API on MetaCPAN when you know what you want to do and need the exact function name and options.
  5. Release notes before you upgrade, or when something behaves differently than a guide says.

Treat the Rex Book as optional reading until it is finished. The API page is a reference, not a tutorial, so reading it cold is slow going.

How do I install Rex?

Rex is distributed on CPAN, the central archive for Perl modules. The release announcements on rexify.org each link to the matching CPAN release. If you already have Perl and a CPAN client, installation is typically one command:

cpanm Rex

Or, with the client that ships with Perl:

cpan Rex

One requirement matters: according to the Rex 1.16.0 announcement, that release and later need at least Perl 5.14.4 to install. Check with perl -v first. The Get Rex page on rexify.org lists the install options the project currently recommends, so check it if the commands above do not fit your system.

What does a first Rexfile look like?

A Rexfile is a Perl file, named Rexfile, that sits in the folder you run Rex from. It describes your servers and the tasks you want to run on them. A task is a named action, such as "check uptime" or "install a package."

The example below is a small, typical starting point. It reflects commonly documented Rex conventions, but the Guides are the authority for your version, including which -feature flag to use.

use Rex -feature => ['1.4'];

user "deploy";
private_key "/home/you/.ssh/id_rsa";
key_auth;

group web => "web01.example.com", "web02.example.com";

desc "Show how long the web servers have been up";
task "uptime", group => "web", sub {
    say run "uptime";
};

Here is what each part does:

  • use Rex ... loads Rex and turns on a set of default behaviors.
  • user, private_key and key_auth tell Rex to log in over SSH with a key, as the user deploy.
  • group web => ... gives a name to a list of servers.
  • desc is a one-line description that shows up when you list tasks.
  • task "uptime", group => "web", sub { ... } defines the task. Inside it, run executes a shell command on each server and say prints the result.

Replace the host names, user and key path with your own. Because a Rexfile is Perl, you can later add variables, conditions and loops with the language you already have.

How do I run a Rex task?

From the folder that holds the Rexfile:

rex -T

This lists the tasks Rex found, along with their descriptions. Then run one by name:

rex uptime

Rex connects to each server in the web group over SSH, runs uptime, and prints the output. To target a single machine without editing the file, Rex lets you pass a host on the command line with -H. Run rex -h to see the options your installed version supports.

Once that works, the next step is a task that changes something. Rex has built-in functions for common jobs such as installing packages and managing files and services. Look these up in the API docs on MetaCPAN. Try a change on one test machine first, since a task that installs or restarts something does exactly what it says on every server in its group.

How do I keep up with new Rex releases?

The rexify.org home page lists announcements, and each links to full release notes and the CPAN page. Recent ones from the source material:

  • Rex 1.16.1 (2025-07-05): bug fixes for hostgroup membership lists, finding executables without which, and several issues on BSDs and Solaris, including memory usage details.
  • Rex 1.16.0 (2025-02-05): requires at least Perl 5.14.4, adds new features for running commands on Windows, and fixes bugs in git repository branch operations.
  • Rex 1.15.0 (2024-11-05): several bug fixes and a few new features, released as Rex turned 14.

Before upgrading a machine that runs your automation, read the notes for each version you skip. It takes a few minutes and saves surprises.

What this means for you

If you are a sysadmin, IT generalist or developer who manages more than a couple of servers by hand, Rex is a reasonable way to turn repeated SSH sessions into tasks you can rerun and share. Start with one harmless task like the uptime example, get it running, then move to real work.

If you are a manager or analyst who was sent a Rex link by a colleague, you mostly need to know which Rex it is. Rex automation is about servers and software setup. If the document mentions reports, data warehouses or student data, it is the other REX. Rez is a different tool again.

What to do this week: install Rex, copy the Rexfile above, point it at a machine you are allowed to test on, and run rex -T and then your task. Bookmark the Guides and the MetaCPAN API page. If something fails, check the FAQ before anything else.

Could I build a small tool around my Rex tasks?

Once you automate a few servers, the surrounding admin work tends to land in spreadsheets: which servers are in which group, who asked for a change, what ran and when. With Remy, you can describe a small internal app in plain English, such as a change-request form that feeds a list of pending tasks, or a server inventory with owners and notes. Remy builds the full-stack app and deploys it to a live URL, with a database and sign-in included. It does not replace Rex, which still does the work on your servers. It gives the people around those tasks one place to keep track.

Frequently Asked Questions

5 questions

Is Rex the same as rez?

No. Rez is a package management tool with its own documentation at rez.readthedocs.io. Rex is a Perl-based automation framework documented at rexify.org. The names look alike, and that is why search results mix them up.

Do I need to know Perl to use Rex?

A Rexfile is written in Perl, so some familiarity helps. For a first task, copying the pattern above and changing host names is enough. As your tasks grow, basic Perl (variables, loops, conditions) becomes useful.

Where is the Rex API documentation?

It is on MetaCPAN at metacpan.org/release/Rex, linked as "API" in the Docs menu on rexify.org. Use it as a reference for function names and options once you know what you want to do.

Is the Rex Book finished?

Not according to the site. The menu labels it "Rex Book (work in progress)," so use the Guides and FAQ for the most complete walkthroughs for now.

What Perl version does Rex need?

The Rex 1.16.0 announcement says it requires at least Perl 5.14.4 to install. Later releases, including 1.16.1, continue from that version, so check your Perl version before installing.

How we source, write, and correct our articles. Editorial standards

Related articles

Straight to your inbox.
New pieces as they publish. No noise.