applesauce README

The project's README from github.com/Dr-Emann/applesauce. As one markdown file: README.md.

Applesauce

Applesauce is a command-line interface (CLI) program written in Rust that compresses, decompresses, and prints information about compressed files for HFS+/APFS transparent compression on macOS. It is based on afsctool and offers several key improvements, including better performance, improved multithreading (even for a single file), and reduced memory usage. Applesauce supports all three compression algorithms used by HFS+/APFS: LZFSE, LZVN, and ZLIB.

compression example

Installation

Install via Homebrew

To install Applesauce using Homebrew, run the following command:

brew install Dr-Emann/homebrew-tap/applesauce

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/Dr-Emann/applesauce/releases/latest/download/applesauce-cli-installer.sh | sh

Manual build with Cargo

Details

To install Applesauce using Cargo, follow these steps:

  1. Install Rust and Cargo using the instructions provided at rust-lang.org.
  2. Clone this repository to your local machine.
  3. In the project directory, run cargo build --release to build the program.
  4. The built binary can be found in the target/release directory.

Usage

To use Applesauce, run the following command:

applesauce [compress|decompress|info] file/directory

The options are as follows:

For example, to compress a file named example.txt using the ZLIB compression algorithm, you would run:

applesauce compress -c ZLIB example.txt

Features

Applesauce has the following key features:

Compression Algorithms

Applesauce supports three compression algorithms:

Applesauce defaults to using LZFSE compression. Depending on the type of data being compressed and the desired balance between compression ratio and speed, one of these algorithms may be more suitable than the others.

Improvements Over Afsctool

Applesauce is based on afsctool, but offers several key improvements, including:

Improved Performance

afcstool can compress multiple files in parallel, but applesauce parallelizes at the block level, so even a single file can be compressed in parallel. Applesauce can often be several times faster than afsctool, especially for small numbers of large files.

Reduced Memory Usage

afcstool will load the entire file into memory before compressing it (although it does attempt to use mmap for large files). Applesauce will only keep the block(s) currently being compressed in memory.

Better User Interface

Applesauce outputs a pretty progress bar while it's working, providing a more user-friendly experience than afsctool's sparse output.

Better Compression With Many Small Files

afsctool will compress a file which fits in the xattr after compression, even if doing so actually adds more overhead than leaving the file uncompressed. Applesauce will not compress a file if it would result in a larger file.

Better Error Handling

afcstool overwrites files in place. Although it attempts to restore the file if an error occurs, if it is forcefully terminated while compressing a file, the file may be left in an invalid state.

Applesauce compresses/decompresses files to a temporary file and then atomically renames the temporary file to the original file only when the operation is complete: the file is never left in an invalid state, even if the program is harshly terminated.

This is no replacement for backups: please do not use applesauce on files you cannot afford to lose.

License

Applesauce is licensed under the GNU General Public License version 3 (GPLv3).

Contributions

Contributions to Applesauce are welcome! If you would like to contribute code, please open a pull request on the GitHub repository. If you find a bug or have a feature request, please open an issue on the repository.

applesauce (Dr-Emann/applesauce)

Searching Database…

What is this?Applesauce is a Rust command-line tool that compresses, decompresses, and inspects files using macOS's transparent HFS+/APFS file compression — a modernized replacement for the older afsctool.
So it's not like zipping files into an archive?Not quite — it uses the filesystem's built-in transparent compression, so files stay where they are and keep working normally while simply taking less disk space.
Do I need Rust or anything else preinstalled?Nothing if you use Homebrew or the prebuilt binaries — those are ready to run. Rust and Cargo are only needed for the build-from-source route.
Is it safe to run on files I care about?It compresses to a temporary file and atomically renames it on success, so even a forced kill never leaves a file half-compressed. Still, the author is explicit that this is no replacement for backups: don't use it on files you can't afford to lose.
Does it work on Linux or Windows too?No — it's macOS only. HFS+/APFS transparent compression is an Apple filesystem feature, so there's nothing for it to do on other systems.
Why use applesauce instead of the older afsctool?It's often several times faster because it parallelizes at the block level (even a single large file), keeps only the blocks currently being compressed in memory, shows a progress bar, skips compression when it would make a file bigger, and never leaves files in an invalid state after errors.
Which of the three compression algorithms should I pick?LZFSE is the default and balances speed and ratio; LZVN is Apple's option optimized for 64-bit processors with a high ratio; ZLIB is slower but can compress tighter, especially at level 9, depending on the data.
Can I check how well a file is already compressed?Yes — the info command prints a file or directory's compression ratio and which algorithm (LZFSE, LZVN, or ZLIB) was used.
What are similar projects?dust, veet, fd, duf, macos-sysdata, ripgrep, zerobrew, eza
Creator
Dr-Emann
Size
0.5 MB
Stars
170
Age
3y
Commits · 90 Days