Finding & Comparing

How to replace text in all open tabs on Mac

You can do this with Note My in a single action. Here is how to gather the documents, size the job up from the live count, and carry one change through every open tab at once.

You have renamed something. A constant, an endpoint, a company name, a spelling that was wrong in the template everything was copied from. Now the old string is sitting in six or ten documents and you would rather not open each one and repeat yourself. Note My has a single action for exactly this: one press that carries the same change through every document you have open, at a pace you can follow, with the match count in front of you before you commit to anything.

One press, every open document

The last button in the Find & Replace popover is labelled Replace in All Files, and it operates on every open tab. That makes the tab bar your control surface: the documents you have open are the documents that change, so you decide the reach of the edit by deciding what is in front of you. Nothing is written to disk until you save, which leaves you free to read the result over first.

Warning

Your tab bar is the scope. Bring in every document that needs the change before you press, and close anything you would rather leave exactly as it is — curating the tabs is how you curate the edit.

Its counterpart, Search ▸ Find in Folder… (⇧⌘F), reaches right across a directory tree. It lists every match grouped by file and takes you to any of them at the matching line, and it never changes a file, so you can survey a large job with nothing at stake. The two are built to be used in sequence: search across a folder to find the documents, then replace across the tabs it opens for you. Between them, a rename that started as a vague worry becomes a set you can see and a single press.

Both stay on your Mac: nothing is uploaded, there is no account, and your files never leave the machine.

Replace the string everywhere

  1. Get every document you want changed into a tab

    Press ⌘O and select several files at once — each arrives in its own tab. You can also drag them from the Finder onto the tab bar, right-click a selection in the Finder and choose Note My ▸ Open or Note My ▸ Open in Background, or ⌥-click the + on the tab bar, which offers you a file to open instead of a new blank tab.

    If you are not sure which files contain the string, find them first with Search ▸ Find in Folder… (⇧⌘F). Results are grouped by file, so you can see at a glance which documents are involved; double-click a row and that file opens in a tab at the matching line — the tidiest way to assemble exactly the set you want to change.

  2. Open Find & Replace from the toolbar

    Click the magnifying-glass button in the toolbar, between the Compare menu and Go to Line. The popover opens anchored to it, carrying both fields, the scope segment, the three options, the live match count and the seven buttons — the whole job in one place, right where you clicked. ⌘F raises the macOS find bar instead, the lighter control you already know from every Mac app, which is ideal for a quick look at a word.

  3. Set the scope segment to All Tabs

    The popover carries a segmented control labelled This File / All Tabs. Choose All Tabs. Matches highlight live across the chosen scope as you type, with a running count in the status label, so this is also how you see the size of the job before you commit to it.

  4. Check the count before you change anything

    Type the old string into the find field and read the count. Turn on Case Sensitive or Whole Word if the plain query is catching more than you meant — Whole Word matches your query only where it stands as a word in its own right, so id stops matching width. Find All and Bookmark All both act on the whole match set rather than on the next hit — Bookmark All drops a bookmark on every matching line, so you can step through them afterwards with F2 and ⇧F2.

  5. Type the replacement and run it

    Fill in the replace field, then press Replace in All Files. It is the last of the seven buttons — Find Next, Find Previous, Find All, Bookmark All on its own row, then Replace, Replace All and Replace in All Files — so the widest-reaching action sits furthest from the one you press by reflex.

  6. Save the tabs it changed

    The replacement changes the text in each tab; nothing is written to disk for you. Every tab it touched now carries a leading * on its title. Switch to each one and press ⌘S. If you are finishing up anyway, File ▸ Close All Tabs (⇧⌘W) confirms once for the whole set and offers Save All, Discard All or Cancel, and aborts the close if a save fails.

What the sweep looks like while it runs

The sweep is paced so that you can watch it happen. A progress HUD stays on screen until the last tab is finished. Each tab comes forward in turn with a yellow pulse, and a green pulse marks it once its text has changed. The pace is slow enough to follow, so you can watch the change land in each document rather than take it on trust. If you spot a tab you did not mean to include, that is the moment you learn it — long before you save anything.

When the cascade finishes, the tab you started from comes back. You are not left staring at whichever document happened to be last in the bar, and you do not have to hunt for your place.

Note

Running Replace in All Files sets the scope segment to All Tabs and leaves it there. If your next search feels like it is reaching further than you asked, check that segment before you blame the query.

Regular expressions across tabs

Tick Regular Expression and the same button works on a pattern instead of a fixed string. Leave the box unticked and our find and replace takes your query exactly as typed, punctuation and all. Whole Word and Case Sensitive still apply either way.

Capture groups work in the replacement field. A find of version = "1\.(\d+)\.0" with a replacement of version = "2.$1.0" rewrites the middle number in place across every open tab. This is where reading the count first genuinely matters: a pattern one character too greedy rewrites ten documents wrongly in a single press.

With an unfamiliar pattern, set the scope to This File, get it right in one document, then switch to All Tabs and run it for real.

Recent searches are kept behind the find field, so a pattern you spent time getting right is still there the next time you open the app.

When a macro is the better tool

Replace in All Files carries one substitution through every tab. When the change you need is a small sequence of edits — replace a string, jump to the line above it, delete a line — record it once and let the app repeat the whole routine for you.

Press ⌥⌘R to start recording, do the edit once by hand, and press ⌥⇧⌘R to stop. Recording is ordinary work: you make the change exactly as you would have anyway, and it is captured as you go. Our macro recorder covers the edits you are most likely to want repeated — typing, deletion, paste, navigation, selection, find next and previous, replace, Go to Line, save, encoding and line-ending conversion, bookmarks and tab rename — which between them describe most of the tidying a rename leaves behind.

Play it back with ⌥⌘P. The scope chooser offers Current Tab or All Open Tabs; pick the second and it applies to every open tab. A report sheet afterwards shows Succeeded, Skipped and Failed chips with a reason for every row that was not a success, so you are never left guessing which documents took the change. And one ⌘Z afterwards takes the entire run back, however many tabs it changed.

Troubleshooting

Nothing happened and the Mac beeped

An empty result beeps and the status label reads "No matches". Check the scope segment first — if it still says This File, you are searching one document. Then check Case Sensitive, which is the usual reason a string you can see on screen is not being found.

The status says "Invalid pattern"

With Regular Expression ticked, a pattern that is not valid produces "Invalid pattern: …" and a beep, and nothing is changed. An unescaped bracket or an unbalanced parenthesis is almost always the cause. Untick the checkbox if you meant your query literally.

The count ends in "(capped — narrow your query for full count)"

Your query is wide enough that the label has stopped giving an exact figure and is suggesting you narrow it. Finding, stepping and replacing still cover every match, so a sweep run from a capped count is complete either way. Add a word of context, tick Whole Word, or make the pattern more specific, and an exact count comes back. It is a prompt worth taking: a query that broad, run across every open tab, is usually wider than you intended.

One of the documents did not change

Check the tab bar first: the sweep covers the documents you have open, so a file that was not among them is simply still waiting its turn. Open it in a tab and run the replace again — a second pass over the tabs that are already correct finds nothing to do in them, so there is no harm in repeating it as often as you need.

The files you dragged did not land in tabs

Aim for the empty space at the end of the tab bar rather than the middle of the tabs themselves — that is the target that takes a drop, and a whole selection dropped there arrives as one tab per file. ⌘O does the same job from the keyboard: select as many files as you like in the open panel and each one comes up in its own tab, ready for the sweep.

I want to take the whole thing back

Nothing reached the disk, so you have room to change your mind. Within a single document, ⌘Z steps the edit back in whichever tab is in front, which is all you need when one file out of ten came out differently from the rest.

For the whole set at once, the disk is your reference. If a tab was saved before you ran the replace, open it and use File ▸ Reload from Disk (⌘R): the tab comes back as the version on disk, and reloading never changes the file on disk itself. So the comfortable order is: save every tab you are about to change, read the match count, then replace — with saved copies underneath you, the sweep is something you can try, look at, and run again with a better query.

A tab has an orange dot on it

That means the file changed on disk, not that it has unsaved edits. The unsaved marker is the leading * on the tab title. If something outside the app has rewritten a file while you were replacing text in it, you will be offered Reload or Keep My Version — and Keep My Version keeps the text you have in the tab, ready to save over the top.

Getting the set exactly right

The whole craft of a multi-tab replace is choosing what is in front of you and reading the count before you press. A few routines that make it dependable:

  • Assemble the set with a folder search. ⇧⌘F lists every file under a folder that carries the string, grouped by file. Double-click the rows you want and each opens as a tab at the matching line, so the set you sweep is the set you have just read through.
  • Curate the tab bar. Open the documents that should change and close the ones that should not; the tab bar is the scope, so a document you close before you press is a document that stays exactly as it was. Forgot one? Open it and run the replace again.
  • Let the count be your preview. Matches highlight live as you type, and the running figure in the status label tells you the size of the job before any of it is real. If it says three and you expected forty, the query needs work, not the button.
  • Rehearse in one document. Set the scope to This File, get an unfamiliar query right where you can see every match, then switch to All Tabs and run it for real.
  • Tighten with the options. Whole Word keeps a short query out of longer words, Case Sensitive keeps two spellings apart, and together they account for most of the sweeps people would otherwise want back.
  • Mark the matches to review afterwards. Bookmark All drops a bookmark on every matching line, so once the sweep is done you can walk the changes with F2 and ⇧F2 and read each one in context.
  • Save deliberately. Each edited tab waits with a leading * until you commit it, so you can read a document over, or close it unsaved, long after the sweep has finished.
  • It all happens on your Mac. Your query, your replacement and every document you open stay on the machine. Nothing is uploaded, there is no account and no sign-in.

The controls that shape a sweep

The Find & Replace controls that matter most when replacing across every open tab
ControlWhat it does for a multi-tab replace
This File / All TabsSets how far the count, the highlights and the replacement reach — the document in front of you, or every tab you have open.
Case SensitiveTies the match to capitalisation, so Value stops matching value across the set.
Whole WordMatches your query only where it stands as a word in its own right, so id stops matching inside width.
Regular ExpressionReads the query as a pattern and turns the replace field into a template, so $1 brings a captured group through.
Find AllActs on every match in the chosen scope at once, rather than stepping to the next one.
Bookmark AllMarks every matching line across the scope, ready to step through with F2 afterwards.
Replace in All FilesCarries the replacement through every open tab in a single press, tab by tab, and returns you to where you started.

Frequently asked questions

Does Replace in All Files save the documents afterwards?

Saving stays yours to make, which is exactly what lets you read the result over before any of it is permanent. It edits the text in every open tab and leaves each one marked with a leading * on the tab title until you commit it — ⌘S per tab, or the single confirmation sheet you get from File ▸ Close All Tabs, which offers Save All for the whole set at once.

What is the quickest way to change a string across several files?

Bring them up as tabs and sweep them together. ⌘O takes a multiple selection and gives you one tab per file, and a folder search (⇧⌘F) lists every file carrying the string so a double-click opens each at the matching line. With the set in front of you, one press of Replace in All Files carries the change through all of them, and you can read each document over before you save it.

How do I open Find & Replace?

Click the magnifying-glass button in the Note My toolbar, between the Compare menu and Go to Line. The popover opens anchored to it with the find and replace fields, the This File / All Tabs scope, the three options, the live match count and the seven buttons. ⌘F raises the macOS find bar, a lighter control that is handy for a quick look at a word.

What exactly does Replace in All Files change?

The tabs you have open, which is what turns a rename spanning several documents into a single press. You watch it move through them — a yellow pulse, the edit, a green pulse — and it leaves you back on the tab you started from, with every edited document waiting unsaved until you commit it.

Do capture groups work in the replacement field?

Yes. With Regular Expression ticked, $1, $2 and so on stand for the groups you captured, so you can keep part of what you matched and rewrite the rest around it.

What does "(capped — narrow your query for full count)" mean?

The count on screen has stopped being exact, and the label says so instead of showing a number you could not trust. Searching and replacing still work. Narrow the query if you want a figure you can rely on before you press anything.

Does any of this send my documents anywhere?

All of it stays with you. There is no account and no sign-in, nothing is uploaded and nothing is reported back. Every search, every count and every replacement happens on your Mac, and the documents you open never leave the machine — which is why a sweep across a dozen tabs works exactly the same on a plane as it does at your desk.