8

I'd like to enable HFS+ compression for a directory, applying it to both the existing files in that directory and newly copied files. I expect to be able to read and write the contents of that directory normally.

Does HFS+ treat non-compressible files intelligently, say by trying to compress the first few KB of the file and bailing if it doesn't compress? I don't want non-compressible files expanding or their access significantly slowed down by compression and de-compression.

Is this possible to do out of the box in Yosemite? I'm also open to installing a third-party app (even a command-line one) to enable the compression, if I can then uninstall it later and have the directory retain the compression.

I found afsctool, but it hasn't had a release or update in an year and a half, and I don't want to use unmaintained software. Besides, afsctool works only for existing files, not newly copied ones.

2
  • not sure if this is a dupe or not, so I'll just post this link, see if it helps at all - apple.stackexchange.com/questions/50525/… Also superuser.com/questions/579371/…
    – Tetsujin
    Jul 1, 2015 at 11:18
  • I checked those, and this post is not a dupe of the first one, since I'm not interested in cobbling together a solution using scripts to compress newly added files. Besides, this question adds another consideration, which is that already compressed files should perform no worse. Jul 1, 2015 at 11:51

1 Answer 1

6

The compression is supported by HFS+ file-system out of box, however macOS by default doesn't compress any files.


afsctool

There is a afsctool command-line utility which can transparently compress the files, for example:

afsctool -c some_dir

Install via: brew install afsctool.


ditto

When copying files, use ditto, e.g.

ditto --hfsCompression src dst

When copying files or extracting content from an archive, all the content will be compressed if appropriate.

To check whether a file is compressed using HFS+ compression or not, you can use hfsdebug. See: Compress files with HFS+ compression.


Related: Transparent file compression apps for macOS.

4
  • 1
    Clusters hasn't been updated in years and I've had numerous troubles with it in more recent versions of macOS, including corrupting files it has compressed.
    – grg
    Dec 21, 2016 at 12:39
  • Clusters has worked wonders for me up to and including Sierra. It's current not working in High Sierra but I'm hopeful it will be updated as APFS still supports HFS+ compressed files. Sep 18, 2017 at 10:43
  • 1
    According to the manufacturer, Clusters has been discontinued: latenitesoft.com/clusters/index.html
    – EpicVoyage
    Mar 18, 2018 at 14:21
  • I'm working on a replacement of my own. Mar 18, 2018 at 16:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .