Difference between revisions of "Tar hints for Mac OS X users"

From OpenHatch wiki
Jump to navigation Jump to search
imported>Paulproteus
(Created page with '== Special information for using tar on Mac OS X == You've probably found this page because you created a tar file on your Mac machine, and it contained extra files. == Creatin…')
 
imported>Paulproteus
Line 10: Line 10:
 
* ghello.c
 
* ghello.c
   
Mac OS will create extra files alongside them in the same directory named:
+
Mac OS will sometimes create extra files alongside them in the same directory named:
   
 
* ._Makefile
 
* ._Makefile
Line 21: Line 21:
 
(the hyphen-a stands for "all")
 
(the hyphen-a stands for "all")
   
The simplest way to create a tar file without these files is to ask tar to exclude them when creating the tar file. So if you would have run this command:
+
If you were creating a tarball of your own code to distribute, you should avoid distributing these extraneous files. The simplest way to create a tar file without these files is to ask tar to exclude them when creating the tar file. So if you would have run this command:
   
 
tar zcvf myproject-0.1.tar.gz myproject-0.1/
 
tar zcvf myproject-0.1.tar.gz myproject-0.1/

Revision as of 20:40, 16 December 2011

Special information for using tar on Mac OS X

You've probably found this page because you created a tar file on your Mac machine, and it contained extra files.

Creating a tar file without ._ files

On Mac OS X, sometimes the operating system creates hidden files whose names start with a period and an underscore. For example, if you have these files:

  • Makefile
  • ghello.c

Mac OS will sometimes create extra files alongside them in the same directory named:

  • ._Makefile
  • ._ghello.c

Because they start with dot, many tools hide them by default. You can see them by typing this in the terminal:

ls -a

(the hyphen-a stands for "all")

If you were creating a tarball of your own code to distribute, you should avoid distributing these extraneous files. The simplest way to create a tar file without these files is to ask tar to exclude them when creating the tar file. So if you would have run this command:

tar zcvf myproject-0.1.tar.gz myproject-0.1/ 

instead you would run:

tar --exclude='._*' zcvf myproject-0.1.tar.gz myproject-0.1/

Because you pass the v flag to tar, causing it to operate in verbose mode, you can see which files will be added to the resulting tarball.

References