A completely sane assumption would be that using GNU utility like tar should give you same results on a Mac or a linux distro. Wrong. What you end up with are all these tiny hidden files that shouldn’t be there. Mac OSX loves giving you extra stuff you don’t need. This is so called “Apple Double” (or extended attributes). Why a person using a different OS would need that, have hell no idea. If you’re interested in the source code that causes all that chaos, have a look at Apple’s patch.
Anyway, to make your shiny mac even more universal, install MacPorts, and then (assuming you use default settings):
sudo port install gnutar
sudo mv /usr/bin/tar /usr/bin/osxtar
sudo ln /opt/local/bin/gnutar /usr/bin/tar
You should be able to use the new version now.
There is also another issue. The tar distributed with Mac OS X 10.5 is pretty old (1.15) and the last one Apple was working on is 1.17. And it will stay like that since 1.18 tar is licensed under GPLv3, and it’s very unlikely they will adopt it. Conclusion? Mac OS X will soon become even less useful for software development. Not because of a single utility, obviously. It’s a general trend. Look how easy it is to set up a basic Web environment using Ubuntu, and how much trouble people have fighting all those StartupItems, plists, missing well-known /etc conventions? Is it really Unix? And if you end up compiling every single piece of your operating system, because the ones on DVD are outdated, you probably switch to BSD/Linux sooner than you think.
THANK YOU! I’ve only been on OS X for a little while and was wondering where the hell all these ._ files were coming from in my tar’d file.
I’m happy you found it useful! Speaking of useless files that happen to pop up in your file system, perhaps someone will find this snippet useful for removing
.DS_Storefiles recursively:find . -name ".DS_Store" -exec rm '{}' \;If you don’t want to go that far, you can shut off this behavior by setting COPYFILE_DISABLE=true (for Leopard) or COPY_EXTENDED_ATTRIBUTES_DISABLE=true (for Tiger).
Still doesn’t justify an entirely new, broken version of an ancient tar.
Thanks for the tip! Speaking of Apple breaking things, I feel somehow uncomfortable working with tools that do things different to what I expect. I really like Mac OS, but for development purposes I’m very close to switching back to FreeBSD or Debian. It’s just easier to maintain.