Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

aaphid

macrumors member
Original poster
Aug 3, 2009
35
0
I have a file that I don't know how to open. It's 2GB and from what I remember it was either a .zip or .dmg file. However some time ago when I made it I also removed the last 3 characters from the name and renamed it .mov. This changed the way that finder dealt with it. Now I would like to open it but when I change the suffix to either of the above they aren't recognised making me wonder if either the file is corrupt or maybe it's not a zip or dmg.

How can I tell what the file is? I've gone into terminal and queried it with the "file" command but it just tells me that it's data.

Any ideas?
 
You could try opening it with VLC. It supports a number of movie formats and may be able to determine if it is one of those. It's also possible the file has become corrupt with trying to open it in various applications. If you're comfortable with the command line I may have another option to try.
 
I'm pretty new to using command line but willing to give it a shot.

What do you suggest?
 
Some times there is meta information about a file stored at the beginning of the file and it's usually in ascii format so it's human readable even if the rest of the file is binary. Using the head command we can take a look at the first few lines of the file to see if there's any information to give you a clue as to its origin.

Code:
head -1 path/to/file
Will show the first line of the file.

Below is an example piece of output from using the head command on a MP4 video files that I had laying around.
ftypmp42 mp42mp41 ‘moov lmvhd Æ/¯UÆ/¯_ µ 4Á     @  ‘trak \tkhd Æ/¯QÆ/¯_  4Á   @ V à $edts elst  4Á   mdia mdhd Æ/¯UÆ/¯_ µ 4ÁÇ :hdlr vide Apple Video Media Handler §minf vmhd  $dinf dref  url  gstbl ’stsd  ‚avc1  Và H H  ÿÿ ,avcCBàÿá 'Bà©¼Þ ÔÛ
I highlighted parts that give clues that it is a video file. I'm at a Windows machine (using cygwin for unix) so can't check what a DMG file would look like.
 
Re: what type of File is it?

doing the command head like previously suggested is only viable if the Magic identifier is actually readable. If you're looking at a Macho binary for example that method won't work.

However since MacOS X has has a unix shell, simply open the command line and type:

file filename

in the directory of the file ( or file filepath anywhere ) and you will get the type of file and other useful information about it.

For example doing:
> file Adium
Adium: Mach-0 fat file with 2 architectures
>
 
Code:
head -1 path/to/file
Will show the first line of the file.

Here is what I get:-

Desktop aa$ head -1 path/to/file Test.zip
head: path/to/file: No such file or directory
==> Test.zip <==
smhead(13641) malloc: *** mmap(size=2397048832) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
a-as-mac-mini:Desktop aa$ sm
 
Code:
head -1 path/to/file
Will show the first line of the file.

Here is what I get:-

Desktop aa$ head -1 path/to/file Test.zip
head: path/to/file: No such file or directory

You need to replace path/to/file with the file's path ... just drag the file to the Terminal window.
 
The answer you were looking for...

Use the file command.

$ file journey-lights-live.mp3
journey-lights-live.mp3: MP3 file with ID3 version 2.2.0 tag

edit: I see amiradou also suggested this, and I guess was ignored.
 
Use the file command.
I see amiradou also suggested this, and I guess was ignored.

Thanks Amdahl but I didn't ignore it. I actually mentioned in my opening post that this was already one of the things that I have tried. The "file" command just returns one word "data".
 
You need to replace path/to/file with the file's path ... just drag the file to the Terminal window.

Aaaahhhh, I see!
Here's what I get...

Desktop aa$ head -1 /Users/aa/Desktop/Test.zip
head(2070) malloc: *** mmap(size=2397048832) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.