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.

When I download mp4 files from Safari, I'd like them to open automatically once they have been downloaded. How can this be done?

Safari Preferences->General->Open "safe" files after downloading is checked.

I want to automatically open file that might not be "safe".

share|improve this question
add comment

2 Answers

This answer will describe how not to get the following message when you open a file downloaded from Safari for the first time.

enter image description here

Well, I'm not sure why you're seeing this, but if your files are going to the ~/Download folder, you will have to tell the Operating System that you want that folder out of the quarantine.

Open your Terminal.app (Spotlight for Terminal) and type:

xattr -d -r com.apple.quarantine ~/Downloads

You might have to do it as super user (in which case, use this instead of the above), so if the above fails try with sudo before the command:

sudo xattr -d -r com.apple.quarantine ~/Downloads

note: You will be asked for your password if you use sudo, this is normal.

What is xattr?

The xattr command can be used to display, modify or remove the extended attributes of one or more files, including directories and symbolic links. Extended attributes are arbitrary metadata stored with a file, but separate from the filesystem attributes (such as modification time or file size).

WARNING: By doing the above, the OS will stop caring about files put in the Downloads folder. If you want to only do this for certain files, you will have to download your "safe" files elsewhere and execute the above command in that folder.

If you want to undo the operation, simply remove the -d

xattr -r com.apple.quarantine ~/Downloads

The -r is to make it recursive (so existing files and folders are also modified).

UPDATE I've realized that new files will be put in quarantine when you download them, so although the above command will go file by file and remove the flag, so you don't have to tell the OS that the file is safe every time, in order to completely disable the mechanism, you have to execute an extra command. please make sure that this is ok with you, since you can't do this for single files, it's an all or nothing.

To Disable the warning dialogs completely for any files in the future, execute this command (Again, I'm not 100% sure if you need sudo, just try without it first.:

defaults write com.apple.LaunchServices LSQuarantine -bool NO

And if you ever want to revert the change:

defaults write com.apple.LaunchServices LSQuarantine -bool YES

I can't recall if you need to logoff/logon again or reboot.

Good luck and be careful with those downloads. :)

A restart IS required after these commands.

Link attached for further reading on the Quarantine.

share|improve this answer
    
I've updated the answer, have you tried the second command? –  Martín Marconcini Feb 16 '13 at 19:34
    
Yes, I understand it. The way it works is that safari will open (certain) safe files. But the definition of safe is "is not in quarantine". So until you "manually" try to open it and get the dialog (and accept the file is safe) this flag will prevent the file from opening. I'm surprised tho' because mp4 should open automatically, maybe there's something else going on here. Try with the 2nd command and tell me how it goes. You have to restart after that. –  Martín Marconcini Feb 16 '13 at 19:36
    
did you restart after you executed the commands? It's a system wide service so you have to restart. –  Martín Marconcini Feb 16 '13 at 19:42
    
And what is the way I used to ? how are you downloading files? Do you have a sample that I can try? (shall we go to the chat?) :D –  Martín Marconcini Feb 16 '13 at 19:53
    
let us continue this discussion in chat –  Martín Marconcini Feb 16 '13 at 19:53
show 1 more comment
up vote 1 down vote accepted

One way is to use Hazel. I tried using it and it worked smoothly. However, Hazel isn't free ($25).

The second solution is to use Automator which is part of Mac OS X.

However, using Automator didn't quite work. Some of the mp4 files did open, but for unknown reason some didn't.

Also I'm not sure if Automator has to open the files as soon as they are downloaded, or there is a time frame which it could take to open them. Maybe some one more experiences with Automator could elaborate on this.

share|improve this answer
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.