How do I copy the text content of a dialog box on OS X?

The most generic way may be to use the Accessibility Inspector and copy the text form its window.

In Mac OS X v10.4 and later, Apple provides the Accessibility Inspector testing tool...

Accessibility Inspector presents a utility window that displays the attributes (and values), actions, and position in the accessibility hierarchy of the object currently under the mouse pointer. To use Accessibility Inspector, be sure to enable assistive applications in the Universal Access Preferences.

Accessibility Inspector icon

Here is an example for Trim Enabler, where you can't select and copy the text of the "About" tab:

Trim Enabler - About tab

And the window displayed by Accessibility Inspector:

Accessibility Inspector example

This is with the mouse pointer hovering over the long text, which can then be found in AXValue.

Edit 2014-10-18:

The next example shows step-by-step how to copy text that is not selectable using Accessibility Inspector 4.0:

Open the window from where the information shall be extracted and open Accessibility Inspector, then hover the mouse pointer over the element of interest:

copy_text_with_Accessibility_Inspector

Press Command ⌘ + 7 to lock Accessibility Inspector, then click on the line you want to copy (e.g. AXValue) and press Command ⌘ + C to copy it to the clipboard:

lock_Accessibility_Inspector_and_select_AXValue

Paste the copied text where needed:

pasted text


The general case is that the programmer needs to expose this text on a dialog by dialog basis, so you can't easy just copy the text unless the program intends for you to have that function.

The things you could do, but seem more work than it's worth is enable universal access where the text could be sent to an external device such as a braille display or other special purpose device and somehow captured.

You could also try to crack that program and modify the dialog call to change things so that it's always selectable. That might make a better question for the programming side of things.

You've done the practical thing - take a snapshot and hope the message is logged elsewhere to a text file. Linking to this question might be a nice way to ask the developer of programs where you need this ability to modify their coding practice like Safari, Terminal and other programs mentioned in the comments above.


You can also run a script like this in AppleScript Editor:

tell application "System Events"
    value of UI elements of windows of process "Application Name"
end tell

If you don't see the text in the results, try to add one or more UI elements of parts after value of.