Xcode: Open files in new Tabs instead of new Windows

When I open a new file in Xcode, e.g. from Finder (see the screenshot below) or using the “Xcode > File > Open” menu item, the file is opened in a new Xcode window. Is it possible to tell Xcode to always open files in new tabs instead?

Is the behavior affected by the system wide setting for that?

No, Xcode seems to ignore this setting.

( And even if it did work, I’d prefer a local Xcode setting instead :slight_smile: )

Does this help?

No, because it is about “File > Open Quickly” feature, whereas my question is about “File > Open” or opening a file from the Finder’s context menu.

I believe it works this way because files in a project will open in new tabs when you click on them in the sidebar. But when you open a file outside the project it wants it to be in another window to indicate this is a file outside the project you have open.

1 Like

Hello, thanks. Yes, this seems to be why it works so. And now the question is whether it can be fixed somehow. I often use Xcode for non-project files.

1 Like

Okay, accoring to @SwiftDevJournal on Reddit, the solution is:

Open the Xcode > Open Developer Tool > Terminal menu item. Then type or paste the following command: defaults write com.apple.Xcode NSUserDefaultsExplorerResetPreferenceKeyForOpenInTab -bool false

I didn’t tried it myself though, because I avoid low-level customization. Sometimes it causes problems that are very hard to figure out. (Also, I don’t have the “Terminal” menu item in Xcode > Open Developer Tool. But I suspect the regular Terminal app can be used, right from one’s Dock or the Spotlight search.)

1 Like