116

What's a quick way of copying the path to the directory that's currently open in Finder?

Copying that path is very easy in Linux and Windows file managers - you just need to copy it from the address bar. I don't see a corresponding option in Finder.

14
  • 4
    @AdamEberbach I disagree, the question you linked is about starting a Terminal instance at the current Finder path, this is about simply getting the path Commented Apr 2, 2012 at 4:05
  • 2
    Can you explain what you mean by copying the path? Do you want it to the clipboard in expanded form /Volumes/whatever/path/to/frontmost/window/view or something else? Basically, what is the next step you are going to perform with the path once you have it?
    – bmike
    Commented Apr 2, 2012 at 4:09
  • 2
    @Adam: Not exactly. I'm looking for a quick method - similar to the ones I'm used to on Windows and Linux (i.e. either pressing a couple of keys or clicking and pressing a key or two).
    – Hippo
    Commented Apr 2, 2012 at 4:22
  • 1
    @TimothyMueller-Harder: Though that question is similar, there is a difference between getting the path for a file or folder in the Finder and getting the path for the active window, especially if something is already selected in that window.
    – joelseph
    Commented Apr 2, 2012 at 22:22
  • 1
    @BlankMan Here is the answer to your second question apple.stackexchange.com/questions/40194/…
    – MrDaniel
    Commented Aug 28, 2012 at 12:38

17 Answers 17

90

Option+Command+C

Will copy the path for selected folder or file to the clipboard. Tried on El Capitan.

6
  • 4
    Thanks, this is the very exact answer I wanted to hear. Commented Aug 29, 2018 at 0:59
  • for me it's brining up "snippets" menu.. not sure if its some utility i added or part of os :(
    – Sonic Soul
    Commented Jan 16, 2020 at 22:37
  • Also working for me on macOS Montery
    – Sam
    Commented Mar 20, 2022 at 22:34
  • This does work and is the simplest solution of all the ones listed on this page. But I found only if you press Command before Option. If you press Option first, it copies the entire folder! (macOS Ventura 13.1) Being a reluctant Apple user (my employer only supports Macs, but I've always used Windows) I'm staggered at how complex some tasks are, such as this one. Windows has the location bar (like a browser) and the location can be copied and pasted from there. It's clear where you are, and simple to 'jump' somewhere else. No 3rd party software required - as seems popular here!
    – cyberspy
    Commented Mar 8, 2023 at 9:31
  • For me, this is not working on macOS Ventura even pressing Command first.
    – lony
    Commented Jul 28, 2023 at 10:19
39

Next to the name of the folder in the Finder is an icon depicting that folder. This icon can be dragged to anywhere you need to accept a path - dragging to the Terminal or TextEdit in plain text mode will drop the path as text in the window or document. However, this does not work with all destinations - copying to a rich-text TextEdit document, for example, copies a link to the folder and not the path.

There are some third-party apps, some free, some paid, that add this functionality. You can also create a service with Automator (or AppleScript) to do it, but a simple and free method that I like, especially if you like to use the terminal anyway, is to invoke DTerm on the Finder window and run:

pwd | pbcopy

That will copy the current path to the Mac OS X clipboard.

5
  • Ooh - great use of DTerm. I never spent enough time to learn it's true power, but more people I know swear by it than at it.
    – bmike
    Commented Apr 2, 2012 at 4:26
  • @bmike Yeah, I don't use it much, but it was my first thought when I read this question (after discovering that Finder indeed does not have this functionality built-in by default). It has the advantage that DTerm is a general-purpose tool and not something that needs to be installed or set up for this specific purpose. Commented Apr 2, 2012 at 4:36
  • 2
    This is exactly what I use DTerm for most of the time!
    – jtbandes
    Commented Apr 2, 2012 at 5:34
  • 1
    Also good form to strip the presumptuous newline from pwd's stdout, with a pwd | tr -d '\n' | pbcopy. Commented Dec 17, 2019 at 15:15
  • You can an alias to your shell initialisation file (e.g. ~/.zshrc) so that pwdc will copy the current terminal directory to clipboard, like so: alias pwdc='pwd | pbcopy'
    – Dylan Hogg
    Commented Jan 2, 2022 at 1:53
36

You can use Automator to do this with a single keyboard shortcut that you can use from any app, and without installing 3rd party software.

This Automator Service will copy the path of the Finder's front window, rather than the path of a selected file or folder, so it won't affect what windows are open or what items are selected. The path that is copied is simply text, so it can be pasted anywhere that you can paste text.

  1. Open Automator and create a new Service.
  2. Change "Service receives selected" to no input (or "files or folders" to have it appear from a right click) and leave it set to any application (unless you only want it to work from a specific app, like the Finder).
  3. Add a "Run AppleScript" action to the workflow.
  4. Replace (* Your script goes here *) with:

    try
        tell application "Finder" to set the clipboard to POSIX path of (target of window 1 as alias)
    on error
        beep
    end try
    
  5. Save the Automator Service with whatever name you'd like it to have in the Services menu.

This Automator Service will now be in your Services menu.

Note: This doesn't escape spaces, so if your path has spaces, you may need to quote it. For example, in Terminal, the path would need to be quoted, but in Finder's "Go to Folder" command, it would not. If you want it to copy as quoted, you can change POSIX path to quoted form of POSIX path.

Copy Finder Window Path Service

You can add a keyboard shortcut for the service by going to System Preferences > Keyboard > Keyboard Shortcuts, then click on "Services" in the left pane, then scroll down to the "General" section in the right pane until you find your service.

Copy Finder Window Path Keyboard Shortcut

1
  • Thanks, It is working for me, But one more thing I like to get that If I select some folder and get the "Copy Finder window path" also giving current window path it not having what folder I selected. Can you help me how to get such a way, please? For example, I am in AA folder, AA contains BB folder. If I select BB folder and get the path it contains path till AA only not BB how to get path till BB.
    – Sun
    Commented Sep 2, 2017 at 2:51
32

Command + I, then copy information under Where:

enter image description here

8
  • @daviesgeek thank you so much for inserting an image for me.
    – revolver
    Commented Apr 3, 2012 at 7:29
  • No problem. Glad I could help!
    – daviesgeek
    Commented Apr 3, 2012 at 17:43
  • 7
    This is broken in Yosemite
    – ClintM
    Commented Nov 3, 2014 at 18:37
  • 4
    @ClintM You can still select and copy the text. When you paste what you copied the arrows turn into slashes.
    – intcreator
    Commented Oct 4, 2015 at 18:44
  • 1
    @brandaemon heh... then it's been "fixed"... it didn't work before
    – ClintM
    Commented Oct 5, 2015 at 19:42
23

If you need the path in Terminal/iTerm, you can just select the file/folder in Finder, copy it (Command+C), switch to the Terminal and paste it (Command+V).

You can also drag and drop the file/folder to the Terminal/iTerm.

2
  • 4
    A useful answer to a newbie like me, instead of wasting a lot of time installing 'X' ware. Appreciated ! Commented Jan 16, 2015 at 3:13
  • This answer is just simple and has no external install dependencies... Commented Oct 4, 2018 at 10:52
8

The MacYourself tip Copy file or folder path to the clipboard in Mac OS X Lion works for me on 10.7.4. Basically it leads you through the steps of creating an Automator service that can be used to copy the full path of files and folders from the Finder. You then use it by assigning a custom hotkey or use the right-click menu to copy the path to the clipboard when a file or folder is selected.

enter image description here

If it helps, you can also type the following command into the Terminal to get the Finder to display the full path to the current folder in its titlebar:

defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES

Use the following to turn it off again:

defaults write com.apple.finder _FXShowPosixPathInTitle -bool NO
4
  • Since you already have the AppleScript made (assuming that screen shot is yours), can you please upload it to a service like droplr.com and offer a direct download link please? It'll be more user friendly for the OP. Considering he's new to the Mac OS, i'm assuming he won't like fiddling around with applescripts/automator services
    – Alexander
    Commented Aug 28, 2012 at 6:32
  • @XAleXOwnZX Seeing as the file lives in ~/Library/Services I think describing a method to download the file then copy it here (as ~/Library is hidden by default on Lion), then follow half the MacYourself instructions to add the shortcut would actually be more complicated. The instructions provided by MacYourself are pretty straightforward to follow.
    – binarybob
    Commented Aug 28, 2012 at 6:41
  • works i guess. Lol for these types of questions, i'd usually use package maker to create an installer that takes care of everything as needed, but i'm on vacation =/
    – Alexander
    Commented Aug 28, 2012 at 6:42
  • This appears to be a default on El Captain now
    – William
    Commented Aug 22, 2018 at 1:33
8

If you use Alfred, you can select the items, press ⌥⌘\, and select Copy path to Clipboard.

You could also assign a shortcut to a script like this:

tell application "Finder"
    set the clipboard to POSIX path of (insertion location as alias)
end

This would copy the paths of all selected items:

set l to {}
tell application "Finder" to repeat with f in (get selection)
    set end of l to POSIX path of (f as alias)
end repeat
set text item delimiters to linefeed
set the clipboard to (l as text)

There's a bug on 10.7 and 10.8 where the selection, insertion location, and target properties refer to the second frontmost window after opening a new window. It affects both scripts and Alfred, but not Automator services. As a workaround, you could move focus to another application and back before getting the selection:

activate application "SystemUIServer"
activate application "Finder"
1
  • 1
    Good stuff; note that the bug also affects Alfred. If only selected items are needed (2nd script), you can avoid the bug by modifying the script to operate on input and by assigning it to an Automator-based Service that receives files or folders in Finder.app. To work around the bug when obtaining Finder's insertion location (1st script), you can apply the following, uuugly, but effective hack (works on 10.8.2): hide Finder, then unhide it again after a short delay - this will cause Finder to report the correct selection/insertion location afterward; obvious downside: flashing.
    – mklement0
    Commented Oct 29, 2012 at 13:05
6

Although this doesn't answer your question directly, I have a more efficient method of obtaining the file's path (presumably for it to be pasted into terminal or a text file, for example). Simply drag-and-dropping the file into a text field will automatically insert the file's path.

4

Back a few years ago, I would always have the pos utility written by Gary Kerbaugh to improve finder / terminal interaction.

  • cdf would cd to the path of the frontmost Finder window
  • fdc would open a Finder window at the current shell path
  • posd would just dump the path

This coupled with pbcopy and pbpaste should fit the bill for getting arbitrary paths to text format and then into your clipboard.

I believe homebrew has adopted part but not all of this package so I'm not sure if you can find a workable version of all the above, but it was magic when I first started using it. Now I just use Launchbar to push files around without caring so much about recording a specific folder.

3
  • posd | pbcopy sounds like it would work. The rest seems nice to have (though won't open . work instead of fdc?) Commented Apr 2, 2012 at 4:35
  • It's unix - there should be n+1 other ways to accomplish most things even with n being sufficiently large. I like open . though - it's elegant.
    – bmike
    Commented Apr 2, 2012 at 5:17
  • unfortunately, pos is no longer in homebrew.
    – Memming
    Commented Mar 1, 2015 at 13:39
4

The easiest way I know to get the path to a file or folder is to Get Info on the folder or file (select it, right-click and pick Get Info), and then in the middle "General" section, you can select and copy (command + C) the path.

screenshot of file info with path

As for your other question, clicking on column headers in list view in the Finder does allow you to sort ascending or descending.

I do not understand the last question you ask -- again, I'd say go to the file itself, right-click and do as I described above to get the path.

4
  • 1
    Broken in Yosemite.
    – jcollum
    Commented Jul 1, 2015 at 19:59
  • doesn't exist on High Sierra
    – Kokizzu
    Commented May 30, 2018 at 5:46
  • oh wait, it exists but without / but shown as arrow
    – Kokizzu
    Commented May 30, 2018 at 5:47
  • but when you paste the result, the arrow pastes as a "/"
    – Gorb
    Commented May 31, 2018 at 13:41
4

Dunno why or what i do, but this exists on my PC (High Sierra 10.13.4)

enter image description here

1

On OS X, many things can be accomplished by dragging & dropping. Apple thinks you don't need to be able to access the file path conveniently because everything can be accomplished by drag & drop. I'm not completely of the same mind, but usually I can do what I want.

This is how common actions are performed on OS X where you would need a path in Windows or Linux.

  • To just find out where you are in Finder, right-click (or Command ⌘-click) the folder name in the title area.

  • In a file selection dialog, to navigate to an opened Finder location, drag the folder or any file from that folder onto the selection dialog. This will not move the file or folder like it does in Windows, but set the path of the File dialog instead. (You can also drag a the document proxy icon (from the title bar of most apps) or -drag items out of the Dock to do this.)

  • To get the path of a file in Terminal or another text-only Application, drag the file on the Terminal window.

What is not (easily) possible:

  • Inserting the file path of a file that is supported differently in an Application. For example, dragging an image into TextEdit (in RichText mode) will insert the image itself instead of the file path.
3
  • Potential confusion: Although command-click is the correct action for what you're describing, the term 'right click' in OS X conventionally refers to 'control-click'. Commented Jan 22, 2013 at 11:55
  • @applehelpwriter It works with both Right-Click (which is [Ctrl]+Click) and [Cmd ⌘]+Click, so the sentence is absolutely correct, even though it was edited in by someone else
    – dualed
    Commented Jan 22, 2013 at 14:39
  • Agreed, but I didn't read it that way. The expression "right-click (or Command click)" doesn't parse as two different options, which should be 'do A or B'. Rather, it looks like one option which is given an alternative name in parentheses. That's why I prefaced my comment with 'potential confusion'. Commented Jan 23, 2013 at 10:34
1

Since Yosemite now has Windows-like dropdowns in Info window and this is the top Google result, here's what I came up with:

  1. Press Command + I to bring up Info window, the Comments and Preview sections will be expanded by default
  2. Drag Preview's folder icon into Comment's textbox
  3. Command + A, Command+X to cut the path to clipboard and undo the Comment change, Command + W to close
1

As of macOS Catalina: Like @Kokizzu said, to get the "Copy as Pathname", open your context menu (right-click or two-finger click). Once it is open, hold down the alt/option key to get that option to appear.

0

To copy the active path in Finder, simply control-click the folder or file to bring up the contextual menu. Next, select copy the_folder/file_you_want. Following that, you can paste the path to a terminal window.

2
  • Unfortunately this doesn't copy the whole path (name only).
    – nohillside
    Commented Apr 2, 2012 at 4:47
  • 1
    edited. Doesn't copy the whole path everywhere, but does to a terminal window. If that's what the OP was looking for, then it works.
    – soxman
    Commented Apr 2, 2012 at 5:33
0

I just made a quick Automator Action. The Get first Finder Window Path action will to get the front most Finder windows Posix Path. It a beta, but is working ok. 10.8 only It will return the Posix path of the front most open Finder window.

1, Open the zip and install it by double clicking on the action.

It will go into the Utilities Actions name 'Get first Finder Window Path'

2, drag it as normal to workflow area and add for example the 'Copy to Clipboard' action below it enter image description here

The Service selected can be file or folder if you save it as a'Service' this will enable you to then also use the contextual menu when clicking on any file or folder. doing so will run the actions and only return the Same window result. Not the selected file or folder. Alternatively set it to 'none.

You can save it as a service or like me save it as an Application and then drag the app into the finder windows Toolbar. Where you just have to click it. enter image description here

0

Copy Path Finder Button is by far the easiest method I've found to accomplish this. It's so simple – download it, put in your Apps folder, then drag to your finder's toolbar, done.

1
  • It looks like it doesn't work with OS X 10.9. The application is reported as damaged when I attempt to run it.
    – ThomasW
    Commented Mar 11, 2015 at 3:01

You must log in to answer this question.

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