1

In a terminal (or xterm, or emacs) window, the command: open dirname (where dirname is . or /tmp or /home/fred) doesn't open the the specified directory in Finder. However:

  • Opening a non-directory file works fine, for all sorts of file types.
  • "open dirname" used to work. Alas I can't identify what had changed, but AFAIR there was no OS upgrade or bash upgrade.
  • It doesn't work as root or as normal user.

GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15) Model Identifier: iMac8,1 System Version: OS X 10.11.6 (15G22010) Kernel Version: Darwin 15.6.0

9
  • From the man open page,"open '/Volumes/Macintosh HD/Applications/'" opens that directory in the Finder. Just to rule out, can you check man page of your system? Also, is the path being given as a string, just for convincing?
    – anki
    Commented Oct 2, 2019 at 16:57
  • Try /usr/bin/open . just to make sure you're running the system open.
    – lhf
    Commented Oct 2, 2019 at 17:04
  • "open '/Volumes/Macintosh HD/Applications/'" doesn't do anything either. "/usr/bin/open ." is the same -- does nothing. On Linux I'd use "strace open ." to see what the program is doing, but I don't know OSX so well so I don't know how to trace. I wonder is there some deep permissions thing that isn't allowing Finder to open a folder? Commented Oct 2, 2019 at 20:28
  • On my macOS 10.14.5 Darwin-18.6.0-x86_64-i386-64bit, GNU bash, version 3.2.57(1) open '/Volumes/Macintosh HD/Applications/ opens a finder window with the Applications folder. open /tmp also gets opened in a finder window despite being in a hidden directory . (ping me by @ankii).
    – anki
    Commented Oct 3, 2019 at 3:22
  • Did you already reboot? Can you create a new user account on your Mac and try from there?
    – nohillside
    Commented Oct 3, 2019 at 15:58

1 Answer 1

1

from man open:

 -R  Reveals the file(s) in the Finder instead of opening them.

So try open -R '/home/fred'

(Technically you don't need the single-quotes around /home/fred unless there are spaces or special characters, but it doesn't hurt to use them anyway.)

5
  • open -R /tmp opens root directory(not tmp) in finder, while open /tmp opens tmp directory despite being in a private directory. See my comment above too.
    – anki
    Commented Oct 3, 2019 at 3:27
  • Partial success! open -R dirname does work -- it correctly opens the parent directory. (However, as mentioned before, open /tmp/ does nothing.) Also, invoking as open -a /System/Library/CoreServices/Finder.app makes no difference: it works with -R and doesn't work without. Commented Oct 3, 2019 at 10:27
  • For directories it should work without -R. It works in my case on Mojave.
    – Matteo
    Commented Oct 3, 2019 at 11:56
  • -R is primarily for files with an associated application. open novel.doc will open in Word, open -R novel.doc will reveal it in Finder. As it always opens then enclosing folder that way, open -R /home/fred will open /home to show the fred folder.
    – nohillside
    Commented Oct 3, 2019 at 15:58
  • 1
    Sure, -R isn't perfect, but it's much better than not working at all. E.g. open /a/b gives me Finder open in /a with /a/b selected, so pressing Enter gets me there without using a mouse. A useful workaround -- thanks! Commented Oct 3, 2019 at 17:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .