I have a .txt file that I open regularly on my Mac. I would like the TextEdit window of this .txt file to be wider than it normally is.

I can manually increase the window width every time I open the file by left-clicking and dragging the bottom-right corner further to the right. But, it would be much more convenient if the window was wider by default.

I have tried adjusting the TextEdit window size while holding down the shift key.

I have tried adjusting the TextEdit window size while holding down the ⌘ command key.

I have tried adjusting the TextEdit window size while holding down the control key.

After quitting TextEdit and then re-opening the .txt file, none of the above methods recall the previously-set window size.

I am also open to a method that uses AppleScript to set the window size before the file is opened. Here's the AppleScript command that I currently employ to open the file:

do shell script "open -e " & quoted form of Target_Filepath
  • I've added a note to my answer which provides information surrounding the actual Title Question: "Is it possible to change the default window size of a .txt file in TextEdit?" Jan 13, 2017 at 15:46

1 Answer 1


Instead of changing the default windows size, unless you want to make it permanent and you can just change it in TextEdit > Preferences... then, you can use the following example AppleScript code to open the document in TextEdit and set its size and position on the screen.

First, open the target file, resize and position it on the screen where you want it and the use the following AppleScript code to get the bounds of the document window to use going forward.

tell application "TextEdit" to get bounds of front window

It will return a list, e.g.: {0, 22, 900, 600}, to use with the set bounds ... command.

set targetFile to POSIX path of (path to documents folder) & "Filename.txt"

tell application "TextEdit"
    open targetFile
    set bounds of front window to {0, 22, 900, 600}
end tell

Note: The reason I'm suggesting the above method is because while one can technically change the default size of the document window programmatically nonetheless since TextEdit doesn't support a position property it makes sense to use the bounds property as the first two list items in the bounds property are its position.

However, if you really want to change the default size prior to opening the target document regardless of it position, here is the information surrounding the default window size. Under TextEdit > Preferences... > New Document > Window Size the default Width is 90 characters and the default Height is 30 lines. With these defaults there are no keys in the com.apple.TextEdit.plist file for this however the corresponding keys are WidthInChars and HeightInChars, which support an integer value.

You'd need to test for the existence of these keys and capture their values so as to have something to reset to after opening the target document. If they are the true defaults, the keys will not exist and you can temporarily set a integer value for these keys, open the target document and then delete the keys. The target document window will open with the new values at the default location of TextEdit's choice, not yours. If you want it in a different location you'd need to use set bounds ..., which defeats programmatically temporarily changing the defaults or the existing setting if not the default values.

Example code using the defaults command:

defaults read $HOME/Library/Containers/com.apple.TextEdit/Data/Library/Preferences/com.apple.TextEdit.plist WidthInChars
defaults read $HOME/Library/Containers/com.apple.TextEdit/Data/Library/Preferences/com.apple.TextEdit.plist HeightInChars

defaults write $HOME/Library/Containers/com.apple.TextEdit/Data/Library/Preferences/com.apple.TextEdit.plist WidthInChars -int 120
defaults write $HOME/Library/Containers/com.apple.TextEdit/Data/Library/Preferences/com.apple.TextEdit.plist HeightInChars -int 50

defaults delete $HOME/Library/Containers/com.apple.TextEdit/Data/Library/Preferences/com.apple.TextEdit.plist WidthInChars
defaults delete $HOME/Library/Containers/com.apple.TextEdit/Data/Library/Preferences/com.apple.TextEdit.plist HeightInChars

These can be used in a do shell script command using set variableName to do shell script "defaults read ..." and then write the logic flow based on what's returned.

If you really want to go this route and need help with the coding, let me know.

Also note that testing surrounding this was done under macOS 10.12 and may be different in previous major OS version releases.

  • The first method works. Thank you. Using the first method, there is a slight delay while the window size adjusts, but that is not a huge deal; I don't think this minor delay is worth the effort to implement the second method. Jan 14, 2017 at 3:27
  • Strangely enough, I've discovered that if you open an .rtf file in TextEdit, adjust the window size, and then save the .rtf file, TextEdit will recall your window size the next time this file is opened. This does not apply to .txt files for some reason. Also, the location of the window of an .rtf file is fixed and is not recalled after saving the file. Jan 14, 2017 at 3:42
  • @rubik's sphere, I did my testing using a plain text file having a .txt extension because that is what you had in your question. The info about a Rich Text .rtf file is interesting but really has no bering on your original question or my answer as it was not part of the question to begin with. Jan 14, 2017 at 3:45
  • Yes, I know. It wasn't really related to my question. I just thought that it was strange that .rtf files remember the previous window size, but .txt files do not. Jan 14, 2017 at 3:50

You must log in to answer this question.

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