uutils is an attempt at writing universal (as in cross-platform) CLI utilities in Rust.
To install it:
$ cargo install coreutils
$ ~/.cargo/bin/coreutils
uutils aims to work on as many platforms as possible, to be able to use the same utils on Linux, Mac, Windows and other platforms. This ensures, for example, that scripts can be easily transferred between platforms. Rust was chosen not only because it is fast and safe, but is also excellent for writing cross-platform code.
uutils has both user and developer documentation available:
Both can also be generated locally, the instructions for that can be found in the coreutils docs repository.
- Rust (
cargo
,rustc
) - GNU Make (optional)
uutils follows Rust's release channels and is tested against stable, beta and nightly.
The current oldest supported version of the Rust compiler is 1.56
.
There are currently two methods to build the uutils binaries: either Cargo or GNU Make.
Building the full package, including all documentation, requires both Cargo and Gnu Make on a Unix platform.
For either method, we first need to fetch the repository:
$ git clone https://github.com/uutils/coreutils
$ cd coreutils
Building uutils using Cargo is easy because the process is the same as for every other Rust program:
$ cargo build --release
This command builds the most portable common core set of uutils into a multicall (BusyBox-type) binary, named 'coreutils', on most Rust-supported platforms.
Additional platform-specific uutils are often available. Building these expanded sets of uutils for a platform (on that platform) is as simple as specifying it as a feature:
$ cargo build --release --features macos
# or ...
$ cargo build --release --features windows
# or ...
$ cargo build --release --features unix
If you don't want to build every utility available on your platform into the final binary, you can also specify which ones you want to build manually. For example:
$ cargo build --features "base32 cat echo rm" --no-default-features
If you don't want to build the multicall binary and would prefer to build
the utilities as individual binaries, that is also possible. Each utility
is contained in its own package within the main repository, named
"uu_UTILNAME". To build individual utilities, use cargo to build just the
specific packages (using the --package
[aka -p
] option). For example:
$ cargo build -p uu_base32 -p uu_cat -p uu_echo -p uu_rm
Building using make
is a simple process as well.
To simply build all available utilities:
$ make
To build all but a few of the available utilities:
$ make SKIP_UTILS='UTILITY_1 UTILITY_2'
To build only a few of the available utilities:
$ make UTILS='UTILITY_1 UTILITY_2'