- Mac Unzip Command Line Installer
- Mac Unzip Command Line Options
- Mac Unzip Command Line Mac
- Mac Unzip Rar Command Line
- How To Unzip Files Windows 10
- Mac Unzip From Command Line
Mac OS X will unpack a.tar.gz,.tar, or.zip file automatically when you double-click on its icon. (Note that it may be necessary to unpack some files twice.) If you would rather follow the UNIX-style instructions below you can use the Terminal command-line application, which can be found in your Utilities folder. Unzip is installed but when I login to my remote site via ssh the command does not work. – Amen Ra Jan 2 '13 at 18:43 I just tested the unzip command on my mac in terminal and it works it just does not work when I log in via SSH – Amen Ra Jan 2 '13 at 18:44. 1- Unzip in Terminal One solution is to use Terminal, a built-in program on the Mac. 1) Open Terminal. You can use the Mac search at the top right and start typing Terminal. It will appear, click on it to open the program. 2) Type “unzip” and a space, then drag/drop the zip file into the Terminal window. How to unzip files on mac computers. Unzipping a file on a mac computer is user-friendly and intuitive. To unzip files on a mac, simply follow the steps below: Double click the zipped file. The file will automatically be decompressed by Archive Utility into the same folder the compressed file is in.
By Xah Lee. Date: . Last updated: .
This page is tips about Mac OS X's command line tools about Mac's resource fork.
The info on this page is tested on Mac OS X 10.4.x and OS X 10.6.x.
Note: since Mac OS X 10.7 (released in 2011), the old syntax for accessing resource fork no longer works. The new syntax is
ls -l filename/.namedfork/rsrc
Resource Fork
What is a resource fork?
Resource fork is a feature of the Mac's file system HFS Plus, and older file systems used by Mac such as HFS and “Macintosh file system”.
A file has 2 parts: ① data fork, ② resource fork. The data fork is the file's main content, the resource fork stores some extra data such as icon, version number, embedded images, image thumbnail, and much more.
Some app store main data in resource fork. For example, Quick Time movie files used to store main movie data in the resource fork. This means, you should not simply remove resource fork data.
Is resource fork still used?
Yes. The use of resource fork is discouraged for normal files. However, program executable files such as those “.app” may still need the resource fork intact to work, and many programs, including Apple's software, still create resource fork as of .
for example, see: Safari “.webloc” File.
How to use the command line to find out if a file has resource fork?
Use the
ls -l
command with /rsrc
suffixed to the file name. Note: since Mac OS X 10.7 (released in 2011), you have to use
/.namedfork/rsrc
.For example,
ls -l file.png/rsrc
. If the reported file size is 0, then it has no resource fork. Here's a command line log as a example:The file size reported by the unix command “ls”, does it count resource fork?
No. (but if you append your file name with “/rsrc”, then “ls” will report the resource fork's file size.)
How to delete a file's resource fork using command line?
You can overwrite it with a empty file. Western digital ntfs driver for mac. Suppose you want to delete resource fork in “file.png”.Do like this:
See also: Perl Script for Removing Mac Resource Fork.
How to delete a file properly (including resource fork) using the command line?
Using
/bin/rm
is probably doing the right thing. To be safe, one can delete the resource fork first. Example:When using “get info” in Finder, it reports file size by two numbers, for example, “592KB on disk (601,189 bytes)”. What's these two figures exactly? and does KB mean 1024 bytes or 1000 bytes? Does either count the resource fork?
The one in parenthesis is the actual file size (counting the resource fork). The one not in paren is the disk space it occupies, and the M and K abbreviations are multiples of 1024.
File | Finder | ls |
---|---|---|
alice.jpg (has resource fork) | 584 KB on disk, (595,041 bytes) | 484995 |
alice2.jpg (no resource fork) | 476 KB on disk, (484,995 bytes) | 484995 |
Note: starting with OS X 10.6, k may mean 1000, not 1024. See: Computing: mega vs mibi, kilo vs kibi.
Does “cp” command copy resource fork?
Yes, as of Mac OS X 10.4
How to view resource?
Look at
/usr/bin/DeRez
. Type “man DeRez” to read how to use it.In 10.4, resource fork related tools are available on the Developers tools CD that came with Mac OS X at least 10.1 up to 10.4. When installed, it's at
/Developer/Tools/
.File Type/Creator
File Type and Creator
What is a File Type/Creator code?
In Windows, file names has a suffix, for example, {.txt, .jpg, .bat, .dll}. This suffix indicates the file's type, and what application is used when user tries to open them. (See: filename extension)
In Mac Classic, the file type and the application associated with the file is stored with the file in the file system. This is the file type and creator code.(See: Type code andCreator code.)
In Mac OS X, the use of file type and creator code is discouraged and is no longer supported starting with Mac OS X 10.6 “Snow Leopard” (2009).
Is file type and creator stored in resource fork?
No.File {type, creator} info is stored in the metadata that {HFS, HFS+} file systems support,along with lock/unlock status, the flag that says whether there's acustom icon, date/time created/modified, etc.
The file type/creator info, and any resource fork, are both lost when transferring the file to other OS without care. When using unix command line utils (cp, tar, gz, etc), whether these data are kept depends on which command you are using. Also, each version of OS X, Apple updates some command line tools so that they preserve these data.
How to find out a file's type and creator code using the command line?
Use “GetFileInfo”. Example:
The “-c” is for creator code, the “-t” is for file type code.
In 10.6, the command “GetFileInfo” is at
/usr/bin/
.How to change a file's type and creator code using the command line?
Use the command “SetFile”. Like this:
If you want to set it to a bunch of files in dir, you can do it like this: Toggle display mac.
In the above example, all file in the current dir and all sub dir, whose name ends in “.gsp”, will now have a creator code of “GSP+” and file type code of “GSPb”.
File Compression with Meta data
How to create a zip file that preserves Mac meta data?
For 10.6.x, in Finder, right click on a file and pull the menu “Compress ‹name›”. This will create a zip file with all meta data preserved.
In 10.4.x, the menu is “Create Archive of ‹folder name›”.The command line equivalent is:
ditto -ck --sequesterRsrc --keepParent myFolder myFolder.zip
.The above method puts the resource forks and HFS meta-data into a subdirectory “__MACOSX__”. You may just want to use this instead:
ditto -ck --rsrc --keepParent myFolder myFolder.zip
.Note: Mac OS X 10.5 changed the tool it uses for dealing with zip files.Its new compression tool is The Unarchiver.For detail, see Archive Utility (aka BOMArchiveHelper).
How to unpack a zip file that has Mac meta data?
In Finder, double click on a file. The command line equivalent is
ditto -xk myFolder.zip myFolder
.Does the command line program “zip” and “unzip” understand metadata?
Mac Unzip Command Line Installer
No, as of Mac OS X 10.6.2. The command line tools at
/usr/bin/zip
and /usr/bin/unzip
do not understand Mac meta data.Using command line zip will simply create a archive without Mac metadata. Using unzip to unzip a zipped folder that has Mac metadata, will create a extraneous directory “__MACOSX__” and or extraneous files with names prefixed by “.”.
Does tar, gzip, gunzip understand Mac metadata?
On OS X 10.6.3, tar, gzip, gunzip, will preserve resource fork. On OS X 10.4, no. I haven't tested whether 10.6 preserves file creator and type code.
Mac Unzip Command Line Options
Note that if you want to preserve resource fork, you must use the version supplied with the Mac 10.6.x, at
/usr/bin
. This means if you have installed GNU's version (from Fink or MacPorts), remember to start you command with full path 〔/usr/bin/…〕 if you still want resource fork.Also, if you unzip and untar using a version that does not understand resources, your resources will be lost.
For example, you can do
tar cvf myfolder.tar myfolder
. This will result a new file named tar cvf myfolder.tar
. This file itself will have no resource fork. All the resources are embedded in the file. Now, move the tar file to a new dir, untar it by tar xvf myfolder.tar
. The result dir's files will still have resource fork.Also, it appears that, whether tar, gzip, gzip understand resource fork depends on a undocumented environment variable. For OS X 10.4, this variable is COPY_EXTENDED_ATTRIBUTES_DISABLE. It can be set to “true” or “false”, but in OS X 10.5, this variable changed name to COPYFILE_DISABLE.This info is from:[Resource forks and tar By Norman Walsh. At http://norman.walsh.name/2008/02/22/tar , accessed on 2014-01-18 ]I have not verified it.
Do you have a folder with Mac metadata i can download and test?
Yes. download this file:macosx_metadata_test.zip.After download, do not use
/usr/bin/unzip
to decompress it, because that would lose the meta data. Use this instead:Thanks to Mark Reed, Kris Gybels, for corrections on the zip utility.
If you have a question, put $5 at patreon and message me.
To use any of these key combinations, press and hold the keys immediately after pressing the power button to turn on your Mac, or after your Mac begins to restart. Keep holding until the described behavior occurs.
- Command (⌘)-R: Start up from the built-in macOS Recovery system. Or use Option-Command-R or Shift-Option-Command-R to start up from macOS Recovery over the Internet. macOS Recovery installs different versions of macOS, depending on the key combination you use while starting up. If your Mac is using a firmware password, you're prompted to enter the password.
- Option (⌥) or Alt: Start up to Startup Manager, which allows you to choose other available startup disks or volumes. If your Mac is using a firmware password, you're prompted to enter the password.
- Option-Command-P-R:Reset NVRAM or PRAM. If your Mac is using a firmware password, it ignores this key combination or starts up from macOS Recovery.
- Shift (⇧): Start up in safe mode. Disabled when using a firmware password.
- D: Start up to the Apple Diagnostics utility. Or use Option-Dto start up to this utility over the Internet. Disabled when using a firmware password.
- N: Start up from a NetBoot server, if your Mac supports network startup volumes. To use the default boot image on the server, hold down Option-N instead. Disabled when using a firmware password.
- Command-S: Start up in single-user mode. Disabled in macOS Mojave or later, or when using a firmware password.
- T: Start up in target disk mode. Disabled when using a firmware password.
- Command-V: Start up in verbose mode. Disabled when using a firmware password.
- Eject (⏏) or F12 or mouse button or trackpad button: Eject removable media, such as an optical disc. Disabled when using a firmware password.
If a key combination doesn't work
Mac Unzip Command Line Mac
If a key combination doesn't work at startup, one of these these solutions might help:
- Be sure to press and hold all keys in the combination together, not one at a time.
- Shut down your Mac. Then press the power button to turn on your Mac. Then press and hold the keys as your Mac starts up.
- Wait a few seconds before pressing the keys, to give your Mac more time to recognize the keyboard as it starts up. Some keyboards have a light that flashes briefly at startup, indicating that the keyboard is recognized and ready for use.
- If you're using a wireless keyboard, plug it into your Mac, if possible. Or use your built-in keyboard or a wired keyboard. If you're using a keyboard made for a PC, such as a keyboard with a Windows logo, try a keyboard made for Mac.
- If you're using Boot Camp to start up from Microsoft Windows, set Startup Disk preferences to start up from macOS instead. Then shut down or restart and try again.
Mac Unzip Rar Command Line
Remember that some key combinations are disabled when your Mac is using a firmware password.
How To Unzip Files Windows 10
Learn more
Mac Unzip From Command Line
- Learn what to do if your Mac doesn't turn on.
- Learn about Mac keyboard shortcuts that you can use after your Mac has started up.