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.

How can I open a file in its default application from the command line?

For example if I have a file foo.doc, can I type command ./foo.doc into the CLI and have that file open in Word?

Note: on my linux machine, I would use xdg-open but that doesn't work on my Mac.

share|improve this question

1 Answer 1

up vote 9 down vote accepted

open foo.doc, or open -n foo.doc to force it to open a new window if one is already open for that app.

share|improve this answer
2  
open is a very good command to get to know. –  CajunLuke Aug 15 '12 at 16:34
3  
open -n opens a new instance, not a window. –  ؘؘؘؘ Aug 15 '12 at 16:37
2  
Also nice is open . (or any directory name in place of .), which opens Finder (the default application for a directory). –  Nathan Long Aug 15 '12 at 17:03

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.