macOS includes a highly aggressive typographical replacement engine known as “Smart Dashes.” By default, whenever you type two standard hyphens (double dashes) in a row, the operating system instantly deletes them and automatically replaces them with a single, long “em dash” (—). This feature is designed to make essays and emails look professionally typeset.
However, if you are a software developer, a system administrator, or a technical writer, this automated replacement is an absolute nightmare. In terminal environments, bash scripts, and markdown formatting, double dashes (--) are heavily used for command-line arguments (e.g., --help or --force). When macOS automatically converts these to an em dash (—help), it creates a syntax error that will cause your scripts and commands to fail completely when you copy and paste them into a terminal.
You can dive into the Keyboard settings in macOS to completely disable this specific typographical substitution, forcing the operating system to respect the exact ASCII characters you type on your keyboard.
How to Turn Off Smart Dashes on Mac
You must disable the substitution globally within the Keyboard preferences.
- Click the Apple Logo in the top-left corner of the menu bar.
- Select System Settings (or System Preferences on older versions of macOS).
- Scroll down the left-hand sidebar and click on Keyboard.
- On the right side of the window, locate the “Text Input” section and click the Edit… button next to your input sources.
- In the new dialog box, look for the toggle switches on the right side.
- Locate the option labeled Use smart quotes and dashes.
- Turn this toggle to the Off position.
- Click Done to save your changes.
macOS will instantly stop hijacking your punctuation. The next time you type two hyphens in a row in a text editor, Notes, or Mail, they will remain as two distinct, standard hyphens, ensuring your code snippets and terminal commands remain perfectly functional.