

To avoid typing this long command every time, we have two options. Will give us the correct path, but it has two downsides: a) it is awfully complex to type repeatedly and b) it fails with an error if no Finder window is open. (I got the idea for this script from this post, though I have modified its solution somewhat.) This command $ osascript -e 'tell app "Finder" to get posix path of ((target of window 1) as alias)' If you are already in Terminal and want to get the frontmost Finder window, we have to do some homework first.
Mac os finder open terminal here movie#
Movie 5: Command Drag a Folder to Terminal Getting Finder path from Terminal

When you command-drag a file it will cd to the enclosing folder of that file. Thanks to Elliot Jordan who pointed this one out on Twitter:ĭragging a folder into a Terminal window while holding the command (⌘) key will add cd before the path to a folder. Just select the files in Finder, choose ‘Copy’ (⌘C), switch to Terminal and ‘Paste’ (⌘V). If you prefer, you can get the same effect with copy and paste. Movie 4: Drag Multiple Files onto Terminal You can drag multiple files and Terminal will insert all of their paths, separated by spaces. For example you can type file in Terminal and then drag multiple files into that window and hit return, to get information on the file type.
Mac os finder open terminal here full#
When you drag any file into an open Terminal window, it will insert the full path to that file or folder with spaces and other special characters properly escaped. Movie 2: Drag Folder from Title Bar onto Terminal You can drag the folder icon from the Finder window title bar, as well. You can drag any folder from Finder to the Terminal application icon in the dock and Terminal will open a new window and change the working directory to the folder you dragged. But for now, they are still available and I am going to use them.Īll of that said, the CLI and the UI are not entirely separate areas in macOS, there is a lot of overlap and there are functions in Finder and Terminal that allow for quick interaction between the two. The future will show how long Apple still values the ‘powerful’ Unix underpinnings. I remember an Apple marketing slogan: “The power of Unix, the simplicity of Mac” This is from OS X Lion, so more than five years old by now. When you know what you are doing, you can get the best of both worlds. I can’t talk for all admins, but for me the strength of macOS/OS X was always in the combination of ‘clicky’ UI and command line. This seems counter-intuitive for an OS that is famed for its user interaction.

Mac Admins have to work a lot in Terminal.
