A Hidden Snow Leopard Feature: HFS+ Compression

Discussion in 'macOS' started by brkirch, Sep 5, 2009.

  1. tplatt macrumors newbie

    Aug 30, 2009
    I was able to get it to compile in XCode by adding frameworks: CoreFoundation, CoreServices, and libz.dylib.

    Does that sound right? I guess it is, because it works :)
  2. brkirch thread starter macrumors regular

    Oct 18, 2001
    I've setup a website for updates:

    That works, although you actually don't need CoreFoundation to be linked in, only CoreServices and libz. To compile through the Terminal try
    gcc -arch x86_64 -arch i386 -lz -o afsctool afsctool.c -framework CoreServices
    The CoreServices framework didn't use to need to be linked in, which is why I didn't include it in my previous post.
  3. Jakimo macrumors 6502

    Apr 25, 2008
    Colorado Springs
    Squeeze - GUI for HFS+ compression

    Check out MacHeist.com this week for a free copy of Squeeze, a utility that does this via a Preference Panel.
  4. andi242 macrumors member


    Jan 27, 2009
    this only works for the system partition.
    if you do store your system on a single partition, you're fine.
    if you have stored files on a second partition Squeeze won't work.
    external drives neither...

    the developers may to lift this restriction in later releases, support told me.

    besides... Squeeze seems to work as a service noticing changes within folders while afsctool is static
  5. CPngN macrumors newbie


    Jun 9, 2008
    Bay Area, California
    I assume that if you stop the service, it simply doesn't monitor those folders to compresss any new data. So if you turn off the service after you compress a few folders, it should be the same effect as running afsctool, no?

    I ran my docs and movies and a few other folders through there and saved 4.x gigs - enough to store an additional DVD ISO. Not bad if it doesn't eat up too many resources after the initial compression effort.
  6. Tu13es macrumors regular

    Sep 28, 2009
                       When copying files or extracting content from an archive,
                       if the destination is an HFS+ volume that supports compres-
                       sion, all the content will be compressed if appropriate.
                       This is only supported on Mac OS X 10.6 or later, and is
                       [B]only intended to be used in installation and backup scenar-
                       ios that involve system files[/B]. Since files using HFS+ com-
                       pression are not readable on versions of Mac OS X earlier
                       than 10.6, this flag should not be used when dealing with
                       non-system files or other user-generated content.
    I stumbled onto this after finding Squeeze. I'm curious as to why the bolded section is there and whether or not using Squeeze will be worth it or not.
  7. lns-pedro macrumors newbie

    Mar 8, 2010
    I believe that message appears for compatibility reasons, as explained in the next sentence in your quote (i.e., compressed files can only be read in Snow Leopard systems). Copying a file to other location, or sharing it from your computer works correctly, so the caveat is there for volumes you use alternatively in several operating systems.
  8. lns-pedro macrumors newbie

    Mar 8, 2010
    Squeeze 1.1 now allows folders in non-boot volumes to be compressed, as long as they are not located in removable media. Please, upgrade to the latest release :)

    The reasons for still excluding removable media are:
    - If you mount a volume in an OS other than Snow Leopard, compressed files cannot be read. We prefer to exclude those volumes rather than cause any inconvenience to users that might not be aware of this limitation. Note, however, that copying a file to any location or sharing it from your Snow Leopard computer will work correctly in all cases.
    - Squeeze being configured to receive filesystem notifications from a folder in removable media would prevent the volume from being ejected while Squeeze is running. Again, this would potentially be the cause of frustration for some users.

    We are looking at ways to further relax the non-boot volume restriction. However, Squeeze 1.1 allowing internal disks to be processed does help with a lot of configurations.
  9. lns-pedro macrumors newbie

    Mar 8, 2010
    That's correct :)

    Using as a background service is intended to keep some folders compressed, which is most useful in locations where reading is much more frequent than writing. For example, pointing Squeeze at your applications folder will ensure that any new application you install will be automatically compressed.

    After the initial compression has taken place, Squeeze will sit there and will only wake up when changes occur in the configured folders. When that happens, Squeeze will only perform compression if your system CPU and disk activity levels are below a certain threshold, so it should not interfere with the rest of your activities.

    Nice savings! :)
  10. Truffy macrumors 6502a


    May 9, 2005
    somewhere outside your window...
    Not so SSD?
  11. kylekai macrumors member

    Nov 23, 2009

    There's a relatively new app called HDCleanUp that does this also, but it's not a preference panel. Drag and drop a file or folder onto its window.

    More info is here: http://web.me.com/wmodesitt/HDCleanUp/Welcome.html
  12. mckyvlle macrumors 6502a

    Nov 21, 2007
    London, UK
    Ooh, I'm rather late to this game...

    To those that have used HFS+ compression extensively/on a daily basis, any pros/cons/caveats to be aware of? Does running compression do anything negative to data integrity?
  13. gnasher729 macrumors P6


    Nov 25, 2005
    Don't do it. All the really space consuming items on your hard drive are already compressed, and HFS+ compression won't help (videos, music and photos). HFS+ compression is excellent for Apple's applications that contain everything needed for 20 different languages inside, and for most users 19 languages will be compressed at all times.
  14. Detrius macrumors 68000

    Sep 10, 2008
    Asheville, NC
    I can't agree with this blanket response. There are situations where it would be beneficial. For example: if you use MacPorts or Fink, you can use this to compress their installation folders, and you can save a fair chunk of space that way. Note, though, that these tools don't help you on files that ever change. These tools are good for files that just sit there. So, if you have a large Boost library installed, for example, it's great for that too. :)
  15. mckyvlle macrumors 6502a

    Nov 21, 2007
    London, UK
    I see. I will give it a go at the Applications, Developer and Macports folders. At least those are easy to replace if it blows up.
  16. danpritts macrumors newbie

    Sep 26, 2007
    For those who are coming to this thread later, like me, many links above are broken (thanks for shutting down .me, apple!)

    I found this:


    Which is the "squeeze" referred to above, I think.

    The afsctool script is on github:

  17. LordDeath macrumors member

    Feb 28, 2013
    I installed this tool over the MacPorts and it is great!
    It saved ~2GiB on my MacTeX installation and it also saved a lot storage on Application Bundles. I haven't noticed something incompatible yet and I also don't feel any performance drawbacks. The Core i5 and the SSD in my MBA are fast enough to compensate this additional on-the-fly decompression. :)
  18. benwiggy macrumors 68020

    Jun 15, 2012
    Funny how things go out of fashion and then return:
    "Eventually, ... changes to the underlying filesystem and ever-increasing drive space killed off this product niche."

    Even a saving of 2Gb on a modern system are not really worth any potential problems -- such as being able to get at your files.
  19. Mr. Retrofire macrumors 601

    Mr. Retrofire

    Mar 2, 2010
    Over 90 percent of Apples OS X is already compressed. So it is a fully supported feature on (Mac) OS X 10.6.x and newer. Btw, Apple compresses also updated parts of OS X.

    Compression is still useful. Even SSDs use compression (SandForce controller).
  20. Ant0ine macrumors newbie

    Feb 10, 2013
    Where does this number come from exactly? 90% of what is compressed ?
  21. MrGimper macrumors 603


    Sep 22, 2012
    Andover, UK
    Just been speaking to the devs of "Clusters".. V 1.7.1 just released is compatible with Mav in case anyone was interested. Think I'll buy it.

Share This Page