I use TextEdit regularly as a scratchpad and to open script outputs. Annoyingly, TextEdit insists on opening a new document window in the top left corner of the screen. Is there any setting I can change to make this the center of the screen or to make it remember the last position of the window?

If this is really not possible, I could 'fake it' and create a script that creates a new TextEdit document and changes the position to the center. But I'd prefer not to do this.

  • When I open TextEdit, the window is always in the centre of the screen. It might help if you edit your post to specify what kind of Mac you're using, what version of macOS, and how large your monitor is.
    – Nic
    Commented Apr 4, 2020 at 23:21
  • @Nic New "Untitled" documents open in the center as well for you? I use a 2015 4K iMac, latest MacOS.
    – Daan
    Commented Apr 5, 2020 at 9:32
  • On my 15" rMBP, new documents in TextEdit go to the middle of the screen. But with an external 1080p monitor, they are shifted slightly to the left. So it does definitely seem related to display resolution.
    – Nic
    Commented Apr 5, 2020 at 19:44
  • Related question: Is it possible to change the default window size of a .txt file in TextEdit?
    – Nic
    Commented Apr 5, 2020 at 19:48

2 Answers 2


It seems that TextEdit hardcodes the position for new document windows, and it's not possible to tweak this behaviour using defaults write to modify TextEdit's Preferences. See this old post from Apple Discussions:

The current version of TextEdit does not maintain a preference in the com.apple.TextEdit.plist file concerning window placement for the document window. What appears to be missing in the TextEdit preferences file is an NSWindow Frame property for the document window itself.

To change the default position of new TextEdit documents there's really only one solution: write a custom AppleScript that can open a new document at your preferred location centered on the screen.

tell application "Finder"
    set screen_resolution to bounds of window of desktop
end tell

tell application "TextEdit"
    set screenWidth to (item 3 of screen_resolution) - (item 1 of screen_resolution)
    set screenHeight to (item 4 of screen_resolution) - (item 2 of screen_resolution)
    set screenCentreX to screenWidth / 2
    set screenCentreY to screenHeight / 2

    make new document

    set defaultBounds to bounds of front window
    set x1 to item 1 of defaultBounds
    set y1 to item 2 of defaultBounds
    set x2 to item 3 of defaultBounds
    set y2 to item 4 of defaultBounds
    set w to x2 - x1
    set h to y2 - y1

    set centreBounds to {screenCentreX - (w / 2), screenCentreY - (h / 2), screenCentreX + (w / 2), screenCentreY + (h / 2)}

    -- "set position" does not work, so we need to fall back on "set bounds"
    -- https://stackoverflow.com/q/12803847/190298
    set bounds of front window to centreBounds
end tell
  • 1
    RE: "-- "set position" does not work, so we need to fall back on "set bounds"" -- As a technical point (only), you could use position trough System Events, e.g. tell application "System Events" to tell application process "TextEdit" to set position of window 1 to {x, y} and eliminate some of the math. That said though, if something can be done without using System Events it's generally less of a issue with security permissions in the newer releases of macOS. Commented Apr 5, 2020 at 21:05
  • @user3439894 Thanks, that's a super useful note. I think using set bounds is more appropriate for my answer, but I sure do appreciate the explanation about set position.
    – Nic
    Commented Apr 5, 2020 at 21:41
  • Thanks for the script and the confirmation that this is (sadly) not possible. I've made a simple script to reposition the windows to the center of my 4K screen: tell application "TextEdit" to set bounds of windows to {683, 357, 1365, 795}
    – Daan
    Commented Apr 27, 2020 at 12:34

@Nic wrote:

there's really only one solution: write a custom AppleScript

Well, no. There are at least two others solutions available that have their own advantages:

A. Use Keyboard Maestro. It comes with a large number of window handling functions. E.g. How can I use KM to open a safari window in specific position shows a ...

... more intelligent macro (to give you some ideas) that will:

  • IF Safari is NOT Running, THEN Open default URL in new window.
  • IF Safari is Running, THEN:
    • IF it has more than one Tab; THEN Move that Tab to new Window
    • ELSE Open new Window using URL of Safari main Window.

This Macro is very fast, and much easier to change/maintain than a script.

B. Modify the public domain version of the TextEdit source to suit your purposes. It is available at https://developer.apple.com/library/archive/samplecode/TextEdit/Introduction/Intro.html

Theoretically, modifying the app code could be the most flexible solution. However I have spent hours poring over the code and, while I can read much of it, I am not a professional Objective C programmer and I have yet to be able to find where the window size and postion are actually set. It appears as if they would be set by the DocumentWindow.nib file, but when I make changes to that file it has no effect on the window size and position.

You must log in to answer this question.

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