Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'd just like to know why if I "tar -czf" a file/directory, osx adds a: ._ for each file? I see these when I untar in linux. Or when I work with the uncompressed project in eclipse as it doesn't like them at all. I use 10.7.5.

share|improve this question
add comment

2 Answers

up vote 11 down vote accepted

OS X's tar uses the AppleDouble format to store extended attributes and ACLs. tar and Archive Utility also know how to convert the ._ files back to the native formats, but the ._ files are kept if the archive is extracted on another platform or on a non-HFS volume.

You can usually just tell tar to remove the metadata by setting COPYFILE_DISABLE to some value:

$ xattr -l file.jpg
com.apple.quarantine: 0002;50d20c48;Tweetbot;
$ tar -cf 1.tar file.jpg 
$ tar -tf 1.tar 
./._file.jpg
file.jpg
$ COPYFILE_DISABLE=1 tar -cf 2.tar file.jpg 
$ tar -tf 2.tar 
file.jpg

Information stored as extended attributes:

  • Resource forks (since 10.4)
    • Custom icons set in Finder and the images of Icon\r files
    • Metadata in PSD files
    • Script objects stored in scpt files, AppleScript Editor window state
  • Information about aliases
  • Quarantine status, download URLs
  • Spotlight comments
  • Encoding of files saved with TextEdit
  • Caret position of files saved with TextMate
  • Skim notes

You can see ACLs with ls -le:

$ ls -led /Applications/
drwxrwxr-x@ 146 root  admin  4964 Jun 17 22:53 /Applications/
 0: group:everyone deny delete
share|improve this answer
    
Great advice on COPYFILE_DISABLE, solved my problems with those nasty ._ files. –  StasM Dec 28 '12 at 1:03
add comment

Those files were always there, but they are invisible in Finder (and most Mac OS applications). See http://superuser.com/questions/212896/

edit

That is: these files contain the extended file attributes ... en.wikipedia.org/wiki/Extended_file_attributes ... and they were created as soon as MacOS gave extended attributes to the files. So these ._* files were not created for the tar archive.

share|improve this answer
2  
NO they're weren't always there as it was something I was working with previously on ubuntu. I guess that osx adds them upon exploding the compressed file onto the system. which of course I didn't know until I took a cop back to the platform of origin. What I'd like to know is wh it adds them in the first place –  Dark Star1 Dec 26 '12 at 18:56
1  
These files contain the extended file attributes ... en.wikipedia.org/wiki/Extended_file_attributes –  GEdgar Dec 26 '12 at 20:18
    
Thanks. Can't accept unless you make it an answer –  Dark Star1 Dec 26 '12 at 23:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.