456

I use command line a lot, like most programmers. I want to be able to launch Finder, Safari or any other application for that matter from command line e.g.

finder .

where it will start Finder app, and the set the view to the current folder that I am in at the command line.

bmike
  • 235,889
Vijay Kumar
  • 4,561
  • 3
    I disagree that this is a duplicate. I found this when Finder was force quitted and I wanted to launch it again. The other question doesn't address this aspect of the problem, this one does. – razzed Aug 06 '14 at 14:14
  • 3
    I agree: not a duplicate. This question is about how to launch the program. The other is just about how to open a new window. – Andy Swift Mar 31 '15 at 08:14

1 Answers1

677

To open your current directory in Finder from Terminal, type open .

So, if you want Documents: open Documents

Library: open /Library

Downloads: open Downloads

And so on.

Dave
  • 12,173
  • 171
    Boom! open . is the winner here. – bmike Sep 10 '13 at 22:33
  • 4
    you did fine - linking the dupes helps with search terms. Your answer or this questions' words get indexed so that people searching the internet find the right answer. – bmike Sep 11 '13 at 01:40
  • I've been wondering for some time what the Mac equivalent to "explorer ." was. Thanks! – Chris Ballance Mar 08 '14 at 18:27
  • 2
    This doesn't work if your current directory is an application, like /Applications/Something.app. It will open that app instead of finder. – Segfault Jul 03 '14 at 20:53
  • Important note, which was helpful to me - if you've Force Quitted the Finder and it doesn't relaunch and you happen to have a Terminal window open, you can relaunch the finder by simply opening a directory, like open . as indicated here. – razzed Aug 06 '14 at 14:12
  • 28
    @Segfault To force it to open an application as a file in Finder, rather than the open the application itself, use the -R option: "-R Reveals the file(s) in the Finder instead of opening them." For example, you can do cd /Applications/Preview.app; open -R . and it will open Finder, not Preview. – AmadeusDrZaius Jun 23 '15 at 20:19
  • 2
    open \pwd`` is safer, does the same thing as open . – computingfreak Jun 23 '16 at 02:56
  • What if I want to open Finder and connect to a server? open ftp://whatever doesn't recognize the protocol, instead it tries to look for a file called whatever in a folder called ftp:. – Aaron Franke Sep 26 '19 at 18:09
  • Related: You can switch to the existing Finder window using open /System/Library/CoreServices/Finder.app – Raine Revere Jul 18 '20 at 20:27
  • If the window doesn't pop up, check the Terminal menu to see if Secure Keyboard Entry is checked. This makes Terminal stay in the foreground. https://discussions.apple.com/thread/253635465 If you can't uncheck it, try a different terminal emulator. – Noumenon Mar 04 '23 at 02:22