Guides

Dictation for coding on a Mac: what voice is good for, and where it struggles

Dictation for coding on a Mac works well for the words around code: comments, commit messages, prompts to AI coding tools, documentation and chat. It works badly for code itself, because brackets, exact spacing and casing are not how anyone talks.

YapToText, the free app I built, types into Terminal, VS Code, Xcode and other editors at your cursor, and its Code Comment mode turns a spoken thought into concise technical text with your identifiers kept as you said them. My hands make typing difficult, so I dictate every day. Below: what to say out loud, what to type or spell, how to set up your editor and terminal, and Apple's own options for writing code by voice.

Download YapToText on the Mac App StoreDownload for free. No account, nothing locked, macOS 14 or later on Apple silicon. Source on GitHub.

On this page: 10 sections
  1. Steps
  2. Dictate the words around your code
  3. Expect trouble with symbols and syntax
  4. Set up YapToText for your editor and terminal
    1. Step 1: Let it type into other apps
    2. Step 2: Dictate where the text goes
    3. Step 3: Choose how the words are shaped
    4. Step 4: Teach it your names
  5. Dictate a prompt or a command in a terminal
    1. Apple Dictation in Terminal
  6. Write code by voice with Voice Control
  7. If the words do not land in your editor
  8. What it cannot do
  9. The short version
  10. Questions

Steps

  1. Install YapToText from the Mac App Store and switch it on in System Settings, Privacy & Security, Accessibility.
  2. Click into your editor, your commit message box or your terminal prompt.
  3. Tap Right Command, say the comment, commit message or prompt, and tap Right Command again.
  4. While you talk, press 2 for Raw Transcription or 7 for Code Comment if Auto mode's choice is not what you want.
  5. Add the identifiers and names you say often on the Dictionaries page.

Dictate the words around your code

The best uses are the ones where a person, or an AI tool, reads the result. If a person will read it, say it; if a compiler will read it, type it or spell it.

  • Comments. A sentence explaining why the code does what it does is just a sentence. Dictate it where the comment goes.
  • Commit messages. YapToText's Code Comment mode exists for these: precise, imperative phrasing with no filler.
  • Prompts to AI coding tools. A long prompt full of context and constraints is easier to say than to type, and it is mostly ordinary language.
  • Documentation. READMEs, docstrings in plain words, design notes and release notes.
  • Review and chat. Pull request comments, issue replies and messages to your team.

Expect trouble with symbols and syntax

Code is mostly symbols, and every dictation tool turns a symbol into a name you have to say. Apple's Dictation has spoken names such as open brace, underscore and vertical bar, and YapToText's Commands page has 45 punctuation commands, from open paren to backslash. Saying open paren and close paren around a function call gets old by the second argument. Dictation hears words, and code is mostly not words.

  • Quotes. Apple's command list shows quote typing a curly quotation mark, not the straight one a shell or a compiler expects.
  • Casing and spacing. camelCase and snake_case are not spoken patterns. Apple's Dictation has no space on and caps on, which help with some names, and YapToText's Dictionaries turn a phrase you say into the exact spelling you want, like swift ui into SwiftUI.
  • Where commands fire. In YapToText, a two-word name such as open paren works on its own at the end of a clause, and a one-word name such as underscore needs the word insert first, because Require the word insert before a command is on by default. That keeps prose safe and makes code slow.
  • Cleanup that means well. Code Comment's instructions say to keep identifiers, casing and technical terms exactly as spoken, but it runs on a small model on your Mac, so read what lands before you commit it. That is caution, not a measured failure rate.
YapToText's Commands page: Enable voice commands on, Require the word insert before a command on, and the Snippets tab.
Figure 1. Require the word insert before a command is on by default, so a one-word name such as period only fires as insert period, and ordinary prose stays safe.

The spoken punctuation guide lists every name YapToText understands, and the Mac dictation commands list has Apple's.

Set up YapToText for your editor and terminal

Four steps, each with something to check. In an editor or a terminal, Auto mode leans toward Code Comment, and a number key overrides it for one dictation.

Step 1: Let it type into other apps

  • You: Install YapToText from the Mac App Store, then on its Home page press Grant next to Accessibility and switch the app on in System Settings, Privacy & Security, Accessibility.
  • macOS: Opens the Accessibility list. An app cannot switch this on for itself.
  • Check: The Get set up card leaves the Home page once Microphone and Accessibility are both on. Without Accessibility, every dictation goes to the clipboard instead.

Step 2: Dictate where the text goes

  • You: Click into the comment, the commit message box or the terminal prompt, tap Right Command, talk, and tap it again.
  • YapToText: Transcribes on your Mac and pastes at the cursor. With Auto mode on, which is the default, Xcode, VS Code, Cursor, JetBrains IDEs, Sublime Text, Zed, Terminal, iTerm2, Hyper and WezTerm lean toward Code Comment. The lean only breaks ties: a dictation of 60 words or fewer usually stays as spoken or gets a careful pass that rewrites nothing, and Code Comment mostly takes the longer ones. The panel says when it detected a code comment.
  • Check: The text is where your cursor was. If Auto shaped it as a comment and you wanted your exact words, the next step changes that.

Step 3: Choose how the words are shaped

  • You: With Auto mode on, which is the default, press 2 for Raw Transcription, 3 for Clean Up or 7 for Code Comment while you talk, in the default order. With Auto off, give each app its own mode instead, in Settings, Advanced, Per-app modes.
  • YapToText: With Auto on, a number key picks the mode for that one dictation, and Auto is back for the next. Per-app modes shape the writing only while Auto is off.
  • Check: In History, Show pipeline details names the mode each dictation used.
The Switch Mode panel listing Auto, Raw Transcription, Clean Up, Note, Email, Message and Code Comment, numbered 1 to 7, each tagged AI cleanup or Verbatim.
Figure 2. The number beside each mode is the key that picks it while you talk.

Step 4: Teach it your names

  • You: On the Dictionaries page, add the identifiers, libraries and product names you say often, with the spelling you want.
  • YapToText: Uses them to prime Whisper as well as to fix what it types.
  • Check: Say the name in a test dictation and see it spelled your way. Fix the same word twice and the app offers to make the correction stick.

The modes guide covers editing Code Comment's instructions, and the dictionaries guide covers Whole word and Case.

Dictate a prompt or a command in a terminal

Terminals get special handling. Intelligent Insert, which reads the text around your cursor with a few invisible keystrokes, is off automatically in Terminal, iTerm2, Warp, Ghostty, kitty, Alacritty, WezTerm, Hyper and Termius, because those keystrokes are shortcuts there. So nothing adjusts case or spacing to fit the line, and the text arrives the way the mode wrote it. At a shell prompt, Return runs whatever is on the line, so look before it goes.

YapToText's Dictation settings page on a Mac: the Keys, Recording, Microphone and Delivery cards.
Figure 3. Under Intelligent Insert on the Dictation page sits the list of apps where it is off. Terminals such as Ghostty, Terminal and Termius are added automatically.
  • For a prompt to an AI tool. Code Comment compresses what you say into short imperative text, which suits a commit message better than a prompt full of context. For a prompt, with Auto mode on, press 2 for Raw Transcription or 3 for Clean Up while you talk; Clean Up drops the ums and keeps your wording.
  • To look before it lands. Review before inserting, in Settings, Advanced, Text output, holds the finished text in a small editor first: Command Return inserts it and Esc discards it. It is off by default, and while it is on, Only for long dictations (200+ characters) keeps short ones out of it unless you switch that off.
  • To send a prompt by itself. After a dictation lands, in Settings, Advanced, Text output, can press Return or Command Return in an app the moment your words arrive. In a tool where Return sends a message, that saves a key press. In a terminal where you also type shell commands, I would leave it off. That is caution, not something I measured.
  • If an app rejects pasted text. In Settings, Advanced, choose Add App Override under Per-app method, pick the app and choose Type character-by-character.

Apple Dictation in Terminal

Apple says Dictation works anywhere you can type, and its Dictation guide does not single out Terminal or code. Its command list does include the symbols a command line uses, such as forward slash, backslash, vertical bar and underscore. Two catches: quote types a curly quotation mark, and Dictation stops after 30 seconds without speech, which can end a long prompt while you think. On an Apple silicon Mac you can keep typing while Dictation listens, so you can type a symbol and keep talking.

Write code by voice with Voice Control

If typing symbols is not an option at all, Apple's Voice Control goes further than Dictation. Its Spelling mode enters one character at a time, and Apple's Voice Control guide for macOS Tahoe 26 and later adds a Swift mode: you pronounce the code as you would read it aloud, and Voice Control handles Swift syntax and formatting, such as where spaces go, which words are operators and where capitals belong in a name. I have not tried Swift mode myself, and Apple describes it for Swift only. For code written entirely by voice, Voice Control is Apple's route, and YapToText is for the prose around it.

Say: To Voice Control on macOS Tahoe 26 or later, before you speak Swift.

Swift mode

What happens: According to Apple's guide, Voice Control switches to writing Swift code from what you say. Say Dictation mode to go back to ordinary words.

Two things to know before you mix Voice Control with YapToText. While Voice Control is on, standard Dictation is not available, and in Voice Control's Dictation mode any word that is not a command is typed, so say Command mode before you dictate with YapToText. The comparison of Voice Control and Dictation covers both features side by side.

If the words do not land in your editor

Check the window and the permission before anything else. A prompt that lands in the wrong place is still in History. Climb this ladder, smallest step first:

  1. Click into the editor first. YapToText never types into its own window, so a dictation started with YapToText in front goes to the clipboard.
  2. Turn on Accessibility. Without it, every dictation is copied to the clipboard instead of typed. Step 1 above has the switch.
  3. Stop a beep in an editor. If an editor plays the alert sound when the words land, Intelligent Insert's keystrokes are the likely cause. On the Dictation page, in the Delivery card, choose Turn off in another app and pick the editor. Terminals are on that list already.
  4. Pin a method. If an app rejects pasted text, add it under Per-app method in Settings, Advanced, and choose Type character-by-character.
  5. Find it in History. By default History keeps your last 500 dictations for 30 days, so a prompt that landed in the wrong window can be copied or inserted again.
YapToText's History page: a search field, date and mode filters, and dictations tagged with their mode, app and time.
Figure 4. History keeps each dictation with its mode and the app it went to, so a prompt that landed in the wrong window can be copied or inserted again.

The Intelligent Insert guide and the troubleshooting guide go further.

What it cannot do

  • Understand your code. YapToText types what you said, shaped by the mode. It does not read your project or check syntax.
  • Move around your editor. Its spoken commands are punctuation, emoji and snippets, with nothing for jumping to a line or selecting a block. Voice Control has commands for selecting and editing text.
  • Lean the same way everywhere. Auto mode's Code Comment lean names Xcode, VS Code, Cursor, JetBrains IDEs, Sublime Text, Zed, Terminal, iTerm2, Hyper and WezTerm. In any other editor, pick the mode yourself.
  • Run on older Macs. It needs Apple silicon and macOS 14 or later, and nothing is claimed for Intel Macs.

If you would rather run Whisper on audio files from the command line, the local Whisper guide has the whisper.cpp commands. It types what you said; it does not write code for you.

The short version

  • Say the prose. Comments, commit messages, prompts and documentation.
  • Type or spell the syntax. Symbols and exact names, or use Voice Control's Spelling and Swift modes.
  • Pick the shape. Code Comment for commits and comments, Raw Transcription or Clean Up for prompts.

Say the why, spell the syntax. If an editor or terminal does not take the words, tell me which one in an issue on GitHub. Every one gets read.

Download YapToText on the Mac App StoreDownload for free. No account, nothing locked, macOS 14 or later on Apple silicon. Source on GitHub.

About the author. Ryleigh Newman is a developer whose hands make typing difficult and who dictates every day with YapToText, the app this site describes. Facts about other apps come from their own sites, with the date they were read. More about the project.

Sources

Questions

Can you use dictation for coding on a Mac?

Yes, for the words: comments, commit messages, prompts and documentation dictate well. Code itself is mostly symbols, which every dictation tool makes you say one by one, so type or spell those parts.

Does speech to text work in Terminal on a Mac?

Yes. YapToText types into Terminal, iTerm2 and other terminals at the cursor, and turns off Intelligent Insert there because its keystrokes are shortcuts in a terminal. Apple says its own Dictation works anywhere you can type.

Does dictation work in VS Code on a Mac?

Yes. YapToText types at the cursor in VS Code, and with Auto mode on it leans toward Code Comment there. Apple Dictation also types anywhere you can type.

Can Voice Control write code on a Mac?

Yes, in Swift. Apple's Voice Control guide for macOS Tahoe 26 and later lists a Swift mode that writes Swift code as you read it aloud, and Spelling mode enters any characters one at a time.

Can I run Whisper in Terminal on a Mac?

Yes. whisper.cpp builds a command-line tool, whisper-cli, that transcribes 16-bit WAV files on your Mac. It transcribes files rather than typing into your editor, which is the job a dictation app does.