How to stop Mac to convert typing double dash to emdash?

107

29

I think it's a Mountain Lion thing, when you type - (dash) twice, it becomes — (emdash). When you type tm, it becomes ™ (trademark symbol). Or when you type three . (dot), it becomes … (elipsis). Some are useful, some are very annoying. Overall, I want to stop that. How can I achieve this?

beatak

Posted 2013-02-22T06:46:59.450

Reputation: 1 173

2Just a note for other people reading, that if it's not a OSX thing for you, then it may be your text editor. I had to change TextEdit with Preferences > Smart dashes. – levininja – 2016-06-16T15:58:32.987

wonder what the solution of macOS Sierra is. – Charlie Parker – 2016-12-13T01:06:36.253

It seems that some apps have to be closed and open for things to work. I was using notes app and it seems it didn't to work until I closed an open the app (completely quit it). It might have been I did defaults write 'Apple Global Domain' NSAutomaticDashSubstitutionEnabled 0, but who knows. – Charlie Parker – 2017-03-20T20:49:06.587

Answers

104

(on Sierra 10.12, this is now in the Keyboard control panel)

Go to the system preferences and choose "Language & Text"

enter image description here

In the "Text" tab you will find the list of substitutions.

enter image description here

If you want to stop -- from being turned into (emdash) you need to use the + button and add a new rule to replace -- with -- (replace with itself)

Or, right click in a text field and go to "Substitutions" and disable "Smart Dashes"

Stupid Dashes

Matteo

Posted 2013-02-22T06:46:59.450

Reputation: 6 553

4Adding -- to be replaced by itself does not seem to work in Yosemite (and Keynote) :( – Balint Erdi – 2015-03-27T13:47:53.157

2@BalintErdi I just found this question again by googling for the issue, found the answer, thought Hmmm, this doesn't work, what idiot posted that trick and then saw it was own damn edit. LOL. I just updated the answer, hopefully that works better now! – Josh – 2015-04-24T05:23:42.743

Yosemite 10.2: Finding a textfield and then clicking in it reveals that Smart dashes is disabled by default; and adding the substitution -- for -- doesn't work: typing a double dash in TextEdit still gets converted to a single dash. I tried rebooting--no help. – 7stud – 2015-05-25T19:43:02.230

5El Capitan 11.11 This is now on the Keyboard control panel. – vy32 – 2015-11-18T11:58:46.843

in Yosemite 10.10.2 and nothing i can find turns this off. "convert quotes and dashes" has been off for at least a dozen reboots. However, if you hit ⌘z immediately, the substitution is undone. – Vynce – 2015-11-21T01:49:51.893

Ahhhh Smart Dashes, that's what I was looking for! – Jamo – 2016-04-14T09:30:43.247

2I had to close and reopen TextEdit for it to work on Yosemite. No reboot required. – Kris – 2016-04-15T08:52:02.700

Usability geniuses :S Thanks man. An important step is the restart of the app. – Christian Vielma – 2016-08-11T10:13:00.870

it doesn't even let you provide the same text in both for macOS Sierra! How freaking annoying!!! – Charlie Parker – 2016-12-13T01:07:40.343

1Keynote has its own option. Go to edit -> substitutions -> uncheck "smart dashes" – ailnlv – 2017-05-17T04:44:26.613

Thank you so much. This has been very very annoying for the longest of times. – timxor – 2018-09-14T02:39:54.870

I had to go to Edit -> Substitutions menue item. The system settings didn't seem to work properly. – Leo Ufimtsev – 2019-06-24T14:59:52.467

that looks awesome and thank you for this answer, but the thing annoys me most "--" to "—" is not there… Hmm… – beatak – 2013-02-22T07:35:51.167

4ah okay, so if I make another rule as "--" to "--" then it saves my double dashes. Thanks! – beatak – 2013-02-22T07:38:15.050

Ok I thought that it was missing in my case, but I also don't have the substitution. Did it happen in all applications? – Matteo – 2013-02-22T08:00:49.693

At least, I'm running Mountain Lion in English env, where it happens substitution, it happens. (e.g.: Finda.app, naming a file/directory) – beatak – 2013-02-22T12:55:47.307

49

I encountered this same problem on Mavericks (10.9), where the fix has changed slightly. Go to System Preferences, then "Language & Region" then click the "Keyboard Preferences..." button and to go to "Text" tab. It is no longer a substitution, however, but instead on the right-hand side of the window there is a tickbox "Use smart quotes and dashes". Unticking this stops it changing two hyphens into an en-dash.

One little gotcha: on 10.9.5 with TextEdit (and probably others) you must exit then restart your editor to have this change take effect.

Neil Brown

Posted 2013-02-22T06:46:59.450

Reputation: 611

1And also disables smart quotes. I have no idea why Apple decided to lump those two into the same bucket in the preferences. Fortunately, you can disable them individually under Edit > Substitutions, though that behavior is per-app. – dgatwood – 2016-02-02T01:40:05.163

8In 10.11 El Capitan at least, it's possible to disable just smart dashes (while keeping smart quotes) by running defaults write 'Apple Global Domain' NSAutomaticDashSubstitutionEnabled 0 from the terminal. There are two separate settings under the hood, NSAutomaticDashSubstitutionEnabled and NSAutomaticQuoteSubstitutionEnabled, both of which get toggled by the UI checkbox "Use smart quotes and dashes". But there's no guarantee from Apple that this won't change in future versions of OS X. – Adam Rosenfield – 2016-02-17T22:23:42.897

1thanks a lot @AdamRosenfield, your solution is by far the best listed here. – zanona – 2016-04-05T12:14:54.317

1@AdamRosenfield, you should elevate this comment to an answer so we can vote for it. :-) – Nick K9 – 2016-07-19T16:14:50.207

you sure this works? Do I need to reboot my Mac or restart my apps? – Charlie Parker – 2017-03-10T19:40:09.550

26

In 11.11 this is under System Preferences > Keyboard. There is a checkbox for Use smart quotes and dashes.

Keyboard pref in 11.11

Aaron B

Posted 2013-02-22T06:46:59.450

Reputation: 361

4Except that doing that also disables smart quotes, which you probably don't want to do. Turning off smart dashes under Edit > Substitutions fixes the problem more cleanly (turning off just the dashes), with the caveat that the behavior is per-app. (Why!?!) – dgatwood – 2016-02-02T01:39:15.390

1Why would you want smart quotes? I've always considered those a solution to a problem that never actually existed. They are also especially horrid for programmers. – coredumperror – 2016-11-01T19:01:16.020

you sure this works? Do I need to reboot my Mac or restart my apps? – Charlie Parker – 2017-03-10T19:40:21.797

@dgatwood So not all applications support Edit > Substitions. In Slack for instance I see no solution other than to disable both as this answer suggests doing. +1 for this answer (although I don't mind smart quotes if type them in) – Mark Edington – 2017-03-22T14:05:21.103

18

In earlier versions of Mac OS X, there were two separate options for smart quotes and smart dashes in the Keyboard System Preferences; however in at least versions 10.9 through 10.11, that option has been replaced by a single "Use smart quotes and dashes" preference.

Fortunately, there are still two separate preferences under the hood, and the UI checkbox toggles both of them simultaneously. You can enable or disable just one of smart quotes or smart dashes from the terminal:

# Disable just smart dashes
defaults write -g NSAutomaticDashSubstitutionEnabled 0

# Disable just smart quotes
defaults write -g NSAutomaticQuoteSubstitutionEnabled 0

# To re-enable, set either back to 1.

This is currently true as of OS X 10.11; this may change in future versions of OS X (or macOS, as it will now be called).

Adam Rosenfield

Posted 2013-02-22T06:46:59.450

Reputation: 1 476

Still works as of 10.12.6 - thank you! – Glenn – 2018-02-06T14:14:42.250

Still works on 10.13 as well. – ShiDoiSi – 2018-03-20T10:38:31.563

Still works on 10.15.2! – Ben S – 2020-01-18T08:41:35.657

4

Not sure if you folks are still having this problem but I just discovered how frustrating it can be. I was writing a unix script for Apple Remote Desktop which requires a --get flag and it kept getting converted to an em dash, ruining the command.

I couldn't find a way to turn off the em dash conversion, but all hope is not lost. In the Language & Text menu (Text tab) I created an entry that replaces -- with -- (i.e. it replaces two dashes with itself). This overrides the system converting -- to an em dash.

jchmski

Posted 2013-02-22T06:46:59.450

Reputation: 41

3

It's worth mentioning that even with "use smart quotes and dashes" enabled, you can still "undo" the auto-conversion of -- to — (emdash) by pressing CMD+Z. If turning smart dashes off completely sounds too extreme, this is one way to bring back the -- (double dash).

Also, here's my horror story about “curly quotes:” I had been using Github for years and wondered why my "contributions" never appeared correctly on my profile. I eventually discovered I had configured my git user name in terminal with curly quotes instead of straight marks:

git config --global user.name “Steve”       //instead of...
git config --global user.name "Steve"

Even though I was copy/pasting the command directly from GitHub's instructions, TextEdit was “fixing” my quotes before I put them in Terminal. Unbelievable! This drove me insane, but I'm recovering...

Stevethemacguy

Posted 2013-02-22T06:46:59.450

Reputation: 131

3

This behaviour is controlled by a system default. To turn it off, type at the terminal:

    defaults write -app 'Keynote' TSWPAutomaticDashSubstitution 0

or

    defaults write 'Apple Global Domain' TSWPAutomaticDashSubstitution 0

The first turns off dash substitution for a particular app (here, Keynote); the second for all apps that don't have their own, overriding, default set explicitly. Replace 0 by 1 to turn dash substitution back on.

As other replies here have stated, the global default can also be changed using System Preferences (Keyboard>Text>Checkbox "Use smart quotes and dashes"), but this turns on and off quote substitution as well as dash substitution. Moreover, some apps, but not all, allow you to change their defaults by control-clicking in a text field and selecting Substitutions or Show Substitutions. For example, Mail lets you do this, but Keynote does not.

If you want to turn on quote substitution, say, for Keynote use

defaults write -app 'Keynote' NSAutomaticQuoteSubstitutionEnabled 1

or, to turn it on for everything that does not have an overriding default, use

defaults write 'Apple Global Domain' NSAutomaticQuoteSubstitutionEnabled 1

To turn it off, use 0 instead of 1.

Andrew Black

Posted 2013-02-22T06:46:59.450

Reputation: 31

For Slack, where this was driving me crazy, I think the setting key is WebAutomaticDashSubstitutionEnabled. – Michael - Where's Clay Shirky – 2017-03-29T15:01:47.907

Exactly what I was looking for, thanks for sharing! – Rogare – 2019-02-25T11:52:00.463

2

In you're using Apple "Office" tools: Page, Number, etc, the settings in System Preferences or the command line defaults command as mentioned in previous answers won't affect the smart substitutions. Instead, you'll have to go to top tool bar Edit > Substitutions menu to check or uncheck 'Smart Quotes', 'Smart Dashes' etc.

If you're using TextEdit then 7stud's answer is the way, which is included here for completeness: TextEdit > Preferences and check/uncheck the settings in the bottom sections.

CodeBrew

Posted 2013-02-22T06:46:59.450

Reputation: 121

1

If you just want to prevent this from happening on occasion, or per some specific instance, you can simply wait for Mac to make the unwanted change and then press CMD+z to undo.

kodmunki

Posted 2013-02-22T06:46:59.450

Reputation: 11

Have you tested this with the "--' and "—" to confirm this works as expected as described by the OP? – Pimp Juice IT – 2017-10-09T17:51:16.540

0

Yosemite 10.2 and TextEdit:

  1. Launch TextEdit.

  2. TextEdit>Preferences

  3. In bottom right corner, uncheck Smart dashes .

  4. If your TextEdit file is open, close it and reopen it.

7stud

Posted 2013-02-22T06:46:59.450

Reputation: 127