The title says it all. We have two words:
Shouldn't they be ...?
This question is really, unwittingly, asking two separate questions:
This is going to be quite long, I fear—in fact probably the longest answer I’ve ever typed out here—but it will also answer both questions in (much, much) more detail than other answers have done so far, so bear with me.
This is a very general pattern in word pairs borrowed from French or Italian, as well as those taken over straight from Latin or created in neo-Latin. The answer to that is to be found in Latin itself.
Latin had three different relevant preverbs: ad- ‘to, towards’; dē- ‘(down/off/away) from, opposite of, not’; and dis- ‘apart, in a different direction, not, un-’. Of these, the two first were also standalone prepositions: ad ‘to, towards’ and dē ‘(down/off/away) from’.
Already from the earliest stages of Latin (several centuries BC), ad- did something that plosives very frequently do: it assimilated to a following consonant. This basically means that the final consonant in ad- (the d) became the same as the following consonant, which created a geminate (double) consonant; so adf- became aff-, adp- became app-, adl- became all-, adt- became att-, etc. Taking a Classical Latin example, ad- + tingō was (almost) never written adtingo, but attingo.1 This explains why attach has two t’s.
As you can tell, dē- and dis- were fairly close in meaning, though they were still distinct in Classical Latin. In Late Latin and Common Romance, however, they started to get confused and merge: you ended up with a random array of dē-, dī-, des-, and dis- all muddled up. Eventually, des- ended up winning out and being the one regularly used in Pre-French and Old French (though some words still retained other forms).
Some time around the late eighth or early ninth century, a sound change occurred in Old French whereby an /s/ became reduced and finally dropped altogether between a vowel and certain consonants (basically, any consonant except /p k b ɡ s/). This means that desX- came to be pronounced something like [dehX] and later just [deX] (where X is any of the triggering consonants). So for example destenir (from Latin dis- + tenēre) became pronounced something like *dehtenir and later on just as detenir. Note that this /s/ just disappeared: unlike the /d/ in ad-, the /s/ here did not assimilate or do anything that would cause the /t/ to double.2 This explains why detach has only one t.
As other answers have mentioned, attach and detach are Old French words, but they are not Latin words. None of them existed in Latin: they were formed in Old French (or rather Pre-French) by adding the preverbs discussed above to a word that had entered the Romance languages as a loan word after the Latin period.
So what was this loan word, then?
Old French estachier ‘plug in, drive in’, from Frankish *stakka ‘post, stake’3
user77834 interprets this as meaning that the French verb is derived directly from the noun (borrowed from Frankish as estaque and estache) as Old French estachier, and that this in turn directly gave later French attacher. This is a very sensible interpretation, and it does indeed appear to be what Larousse are saying.
Unfortunately, it is quite simply impossible. Sadly, Larousse do not cite their sources, so I cannot tell where they get the idea from, but Old French estachier cannot possibly yield French attacher. As we saw above, /s/ between an /ε/ and a /t/ was weakened and lost in (or before) Old French, leaving behind a now tensed /e/ and a non-geminate /t/. The outcome in later French of estachier would be †étacher, not attacher.
In order to get the actually existing word, the preverb a- (the Old French descendant of Latin ad-) must have been prefixed. Whether a- + estache would give attachier, however, is doubtful. For that to be the case (i.e., for the s to be lost and the t geminated), you would need to get ad-, with a d, right next to the t in estache at some point. Three requirements would have to be fulfilled for that to happen:
However, all three premises are unlikely. The final /d/ of ad- was undoubtedly gone by the time the verb was coined: it started disappearing already in Late Latin and in all the Romance languages, it only shows up at all in Italian—and only before vowels there. The prothetic vowel was added as part of an automatic process preventing any word from beginning in /st/, so it must have been added directly to the borrowed word right when it was borrowed as a simple noun, before any verbs were ever derived from it. And in the cluster /dst/ (or /tst/), it seems more likely, given how Romance languages generally simplify clusters, that the /d/, not the /s/, would be lost: compare how in Latin extinguere /ekstingʷere/, it is the first consonant, /k/, that is lost, giving Old French esteindre, Modern French éteindre. So even if you did have *adstachier, it would yield Old French †astachier, and Modern French †âtacher, neither of which exists.
Moreover, to derive détacher from attacher is not without problems, either. The Old French form destacher is attested; we know it existed as an earlier form of détacher. But as I noted above, the general form of the preverb used here in Old French was des-, particularly before vowels (even in Modern French, dés- is used before vowels, even though dé- is used elsewhere), even prothetic vowels (Latin spērāre ‘hope, expect’ gives prothesised Old French espérer ‘hope’, whence is derived a noun espoir ‘hope’; from this is derived désespoir ‘despair’, lit. ‘un-hope’). So if you add de(s)- to estache or estachier, you should get Old French †désestachier and Modern French †désétacher.
It is undisputed fact that the verbs estachier and destachier existed in Old French, and I have no doubt that at least estachier was in fact derived quite simply from estache, which was borrowed from Frankish *stakka-. But to derive attacher from estachier seems quite impossible to me, and to derive destachier/détacher from attacher/estachier equally so.
Having established this, we must seek an alternative solution.
Friedrich Diez’ Etymologisches Wörterbuch der Romanischen Sprachen (1887) mentions attacher (and attaquer ‘attack’) under the group of cognates alphabetised under the Italian word tacco. Let us have a look at these cognates (excerpted, abbreviated, clarified, and translated to make it less confusing):
Notch, jag, offshoot, (head of) nail, tack, stud: Italian tacca, Spanish tachón, Occitan tacho, Old French tac
Patch or stain (esp. on a shoe): Old French teque, tache, Italian tecca, taccia, taccone, Spanish/Portuguese tacha
Heel (of a shoe): Italian tacco, Spanish tacón, Portuguese tacão
Tack/stick onto, attach: Venetian tacare, Lombard tacà, Provençal tacar, Italian attaccare, French attacher
Attack: Italian attaccare, French attaquer
Detach, take off: French détacher, Italian (di)staccare
So the base noun has three different senses: a nail or tack, a stain or patch, and the heel of a shoe. Quite different meanings, though they can all (with a bit of goodwill) be seen as basically something that is attached or stuck onto something else. A jag or a stud is quite literally tacked onto something; the heel of a shoe is an extra, solid bit that is attached to (and can fall off) a shoe; and a patch or stain is something undesirable that’s been stuck (or has stuck itself) onto something else.4
Diez speculates that the sense ‘attack’ started off as a reflexive usage, comparing Italian attaccarsi di ‘attach oneself to’, comparing it with the development in Greek of ἅπτω (haptō), which means ‘fasten, attach to’, but in the middle voice also frequently means ‘set upon, attack’. He notes also that the stem *takk- underlying these words is found in Germanic and Celtic languages as well.5
The Germanic stem found here is discussed briefly in Guus Kroonen’s Etymological Dictionary of Proto-Germanic, which is unfortunately quite new and still not available online. Most of the discussion relates to the Proto-Indo-European origins of the Proto-Germanic form, which is not relevant here, so I’ll just cite the attested forms:
*takkan- m. ‘branch’
Old Saxon tōgo, Middle Low German tagge, takke, Middle Dutch tac(ke), tooch, Dutch tak, toeg, toek, Old High German zuogo ‘branch’;
Old Danish tagge, Low German take ‘prickle (of a plant)’;
Old Swedish tagger ‘spike’; Swedish tagg ‘spine, spike’;
Norwegian tagg(e), Danish tak, tag ‘tip, jag’; Middle High German zacken (pl.) ‘jags’; German Zacke(n) ‘jag, prong’;
Middle English tak(ke) ‘clasp, nail’; English tack, tag.
If this is indeed the root underlying the word that was borrowed from Frankish, it seems the original meaning when the word was borrowed was something like ‘nail, tack, stud’, which must have been broadened (either in Frankish before the borrowing or in French after the borrowing) to meaning anything that was attached to something in the way a nail or stud is ‘attached’ or driven into the surface of the object you nail it into.
The fact that there are two variants in the Romance languages, one with initial tac- (corresponding to Old French [tak-]) and one with tach- (Old French [tatʃ-]) is interesting: it makes it likely that the word was borrowed towards the end of the period in which the sound change known as the Gallo-Romance Palatalisation (the second wave of palatalisations to affect the French language) was productive. During this period, /k/ and /ɡ/ were palatalised to /tʃ/ and /ʤ/ before the vowel /a/. It seems the word was borrowed at a time when some dialects still automatically palatalised /k/ as in *takka-, phonemically /takːa/, to /tʃ/, yielding /tatʃːa/ (which is completely identical with Italian taccia); but others had stopped doing so and could borrow /takːa/ as-is without any change necessary. Both variants apparently gained currency in French, and after sprouting a couple of derived verbs with a- and de(s)- as preverbs, they both started spreading to the neighbouring Romance languages. As a loan word that varied quite a bit both in meaning and form, it is perhaps not too unexpected that both masculine and feminine forms (as well as augmentatives in -on(e)) cropped up.
Taking this root as the basis of attach and detach makes the derivation much easier to envision:
In the derived verbs, the basic sense of ‘nail’ seems to have been somewhat less liable to be broadened: apart from the evolution to ‘attack’, all the verbal forms in all the Romance languages are basically semantically derived straight from the base meaning: they mean to nail something to something else, or to remove the nail from something else, as it were. Attaching and detaching. The further secondary meanings to do with heels, patches, stains, etc., are not found in the verbal derivations.
As I said above, estachier undoubtedly did exist; but so did attachier, if we are to believe Etymonline, who says that while estachier is earlier, attachier is attested from the 11th century. (Sadly, this is not one of those cases where Etymonline is getting their information from the OED; I don’t know where they get these dates from.)
As I mentioned above, the outcome of Latin ex- ‘out of’ before a /t/ was for the /k/ to be lost, leaving /est/ (which regularly lost its /s/ later on as well). Similarly, the outcome of initial /st/ in French was for a prothetic vowel to develop, leaving also /est/. In other words, Old French est- (later ét-) could be either a compound verb consisting of es- (é-) ‘out of’ and a base beginning in /t/, or a base word that had originally begun in /st/.
In this particular case, estachier would be the latter: it meant originally ‘stake’, i.e., ‘drive in a stake’, but later on just ‘add to’ or ‘attach’. Attachier would have meant almost the exact same thing. Essentially, there were two very similar words that meant almost the same thing. One had a very clear and unambiguous preverb a- ‘into’ that fit the meaning of the verb very well; the other had no preverb, but could be understood as having a preverb e(s)- ‘out of’ that meant the exact opposite of what you’d expect, given the meaning of the word. A situation not unlike inflammable, which means the opposite of what it looks like it’s supposed to mean at first blush if you’re not familiar with its etymology. And then there was destachier, which meant what estachier looked like it was supposed to mean, but also had a very clear and logical preverb de(s)- ‘away from’.
Given this mess, it would hardly be surprising if estachier quite simply just died a quiet death. People started using the verbs that were unambiguous and unlikely to cause confusion, and the loser was ambiguous old estachier, dead and buried.
1 Later on, at some stage of Late Latin or Common Romance, the final /d/ in the standalone preposition ad was lost, and the preposition was thenceforth just a (written à in Modern French). At that point, then, the original /d/ only showed up as an actual /d/ in old verbs where the base verb began with a vowel, like adorn (from Latin ad- + ornāre ‘make ornate, deck’): in all other contexts, the /d/ had been either lost entirely or assimilated to the following consonant. From that point on, it doesn’t really make sense to say that the preverb was ad- anymore. Old French even started treating it completely like it was just a-: many of the historically geminate consonants, especially t’s, were simplified, so the Old French descendant of Latin attingere was most commonly spelt ateindre, rather than atteindre. There was quite a bit of variation, though, and doubled consonants were not uncommon, either; for the sake of simplicity, I consistently write geminates where they are etymologically or systematically to be expected, so while atachier and ataquer are more frequent spellings in actual Old French texts, I write them as attachier and attaquer here. Much later on, when French orthography started becoming standardised, they decided to approach the Latin origins of many words, and they reintroduced the geminates.
2 In Old French, they still wrote an ⟨s⟩ before a /t/, so they would have written ⟨destenir⟩. Later on, in the 15th century, all these s’es that weren’t pronounced anyway got kicked out: instead, they added accents over the previous vowel to indicate that there used to be a ⟨t⟩, which is why they now write hôtel, île, and détenir.
3 The initial e in front of the s is regular here. As early as the fifth century AD, initial /sC/ (where C is any consonant) started to fall out of favour, and words that began thus started developing prothetic vowels. This limitation that words couldn’t begin with /sC/ was still alive and kicking in Old French, and it is still very much alive in Spanish as well (think of Spanish people saying “In Espain we don’t estart estaring at people” or something like that). In Modern French and (partially) Modern Italian, though, it’s disappeared again.
4 As a side note, a similar evolution is visible in some Germanic languages. A spot in English, for example, originally meant a plot of land, and the Danish word for a spot is plet, which is etymologically the same word as English plot.
5 I’ll leave out the Celtic evidence here—suffice it to say that they all look like they too could be borrowings from Germanic languages.
The question presupposes that the spellings of 'attach' and 'detach' should have the same number of tees, and so assumes that there must be a reason they do not.
Yet many English words with the same radical and different prefixes are spelled differently, for the obvious reason that the prefix is spelled differently. For example, if the question asked why attack and retack do not have the same number of tees, the naive and in the given case correct and (almost) complete answer could be that the spellings of the prefixes at- and re- differ.
This question, however, encourages an exploration of the etymologies of the words, 'attach' and 'detach', with the main difficulty being presented by 'attach'. The other, 'detach', at no point in its history in English was spelled with two tees, as per the OED:
Forms: In ME distache.
[From "detach, v.". OED Online. September 2015. Oxford University Press. http://www.oed.com/view/Entry/51159?redirectedFrom=detach (accessed October 11, 2015).]
Additionally, at no point in its etymological history prior to adoption in English was 'detach' spelled with two tees:
Etymology: < French détacher, earlier destacher, destachier (12th cent. in Godefroy) = Provençal destacar, Spanish destacar, Italian distaccare, < Romance des-, Latin dis- (dis- prefix) + Romance tacca, French tache .... Used by Caxton in form distache ....
These facts explain completely why 'detach' is spelled with one, not two tees.
All that remains of the question, then, is explaining the reason 'attach' is spelled with two tees or, conversely, why 'attach' is not spelled with only one tee (like 'detach'). As already stated, the obvious and naive explanation of the latter is simply that the affix 'at-' itself contains a tee that is...attached...to the radical 'tach'. Voila! Two tees in 'attach'.
In truth, the foregoing is a sufficient answer: 'attach' is not spelled 'atach' because 'at-' is not spelled 'a-' when it is attached to 'tach'. However, during its etymological history, including a form in Middle English, 'attach' was spelled with only one tee:
Forms: Also ME atache, ....
Etymology: < Old French atachier (modern attacher), cognate with Italian attaccare, Spanish atacar; < à to, at + a radical which is found also in détacher detach v., and is connected by Diez and Littré with the Genevese tache, Spanish tacha, Portuguese tacha, ....
[From "attach, v.". OED Online. September 2015. Oxford University Press. http://www.oed.com/view/Entry/12699?isAdvanced=false&result=2&rskey=pjRwYn& (accessed October 11, 2015).]
This circumstance invites an exploration of why and how 'attach' acquired a second tee.
As background, note that the Latin prefix at- itself derives by assimilation from the Latin prefix ad-:
Etymology: < classical Latin ad- (prefix) < ad (preposition) to ....
Before the consonants c, ..., t, ad- was often assimilated in Latin, as ac-, ..., at- ....
[From "ad-, prefix". OED Online. September 2015. Oxford University Press. http://www.oed.com/view/Entry/2049?rskey=Mjzw3b&result=13&isAdvanced=false (accessed October 11, 2015).]
Thus, in classical Latin, ad- when attached to a radical beginning with a tee was spelled at-.
This last-cited entry in the OED contains a thorough exegesis of the following summary explanation I've cobbled together from the OED and the Online Etymology Dictionary.
Simply, the spellings of 'attach' with a single tee in Middle English as well as in Old French were subject to a classicizing influence. As explained with regard to the development of 'a-' into 'at-' in the OED,
From early in the documented history of Old French, ..., forms are found which show remodelling under classicizing influence, .... This variation in form and spelling is reflected also in French borrowings in Middle English. In later Middle English and especially in early modern English this classicizing trend was often carried further than in French, ....
The period of adoption of 'attach' in English from Old French in the late 14th century (the earliest quotes given in the OED are dated c1380 and c1390 with two and one tee spellings of 'attach' respectively) coincides with the period of "remodelling under classicizing influence":
In Old French, [ad- was] reduced to a- in all cases ... but written forms in French were refashioned after Latin in 14c. and English did likewise 15c. in words it had picked up from Old French.
(From "ad-", Online Etymology Dictionary.)
This subsequent "remodelling" or "refashioning" of 'a-' to the classical 'at-', then, explains the earlier occurrence of forms of 'attach' spelled with only one tee in Middle English as well as in the Old French adoption.
The purpose of this post is to give some basic information on the topic discussed in this thread, so that even a hasty reader who is not familiar with Romance Language[s] philology can understand what is going on.
abbreviations: I[talian], G[erman], E[nglish], F[rench], S[panish], g[othic],Gm (Germanic, PG (Proto Germanic, OF (Old French), f[rancique] (Frankish) ; a word with an asterisk ' * ' is an unattested form: *stakka
the discussion, regarding the origin of F: 'attacher', involves:
Frankish is a dead language, it was the language spoken by the Germanic Franks in the Low Countries and adjacent parts of contemporary France and Germany between the 4th and 8th century.
It belongs to the West Germanic language group and is thought to have given rise to the modern Franconian languages. The Franks descended from Germanic tribes that settled parts of the Netherlands and western Germany during the early Iron Age. From the 4th century, they are attested as extending into what is now the southern Netherlands and northern Belgium. In the 5th and 6th centuries, they expanded their realm and conquered Roman Gaul completely as well as client states such as Bavaria and Thuringia.
Gothic is the earliest extensively recorded Germanic language that has come down to us. Knowledge of it is derived primarily from the remains of a Bible translation made in the 4th century by the Visigothic bishop Wulfila, although the surviving manuscripts are not originals but later copies thought to have been written in northern Italy during the period of Ostrogothic rule (first half of the 6th century).
Old French: Classical Latin’s phonological structure began to change about the second half of the 3rd century B.C., eventually yielding (VL) Vulgar Latin, the common spoken language of the Western Roman Empire. This latter form differed strongly from its classical counterpart in phonology; it was the ancestor of the Romance languages, including Old French Langue d'oïl
By late- or post-Roman times Vulgar Latin had developed two distinctive terms for signifying assent (yes): [h]oc il[le] ("this (is) it") and [h]oc ("this"), which became oïl and oc, respectively. Subsequent development changed "oïl" into "oui", as in modern French. The term langue d'oïl itself was first used in the 12th century, referring to the Old French linguistic grouping noted above.
In the 14th century, the Italian poet Dante mentioned the yes distinctions in his De vulgari eloquentia. He wrote in Medieval Latin: "nam alii oc, alii si, alii vero dicunt oil" ("some say 'oc', others say 'si', others say 'oïl'")— thereby distinguishing at least three classes of Romance languages: oc languages (in southern France); si languages (in Italy and Iberia) and oïl languages (in northern France).
Friederich Diez was one of the founders of Romance-language philology; he was impressed by the comparative methods of Jakob Grimm and Raynouard (Grammaire comparée..) and decided to apply them to all Romance languages, not just the speech of the troubadours, on a systematic basis, thereby becoming the originator of a new field of scholarly inquiry.
He tried to apply the scientific method to philology, stating that:
"1)..it is to follow implicitly the discovered principles and rules of phonology, and not to swerve a foot's breadth from them unless plain, actual exceptions shall justify it; 2) to follow the genius of the language, and by cross-questioning to elicit its secrets; 3) to gauge each letter and estimate the value which attaches to it in each position; and lastly 4) to possess the true philosophic spirit which is prepared to welcome any new fact, though it may modify or upset the most cherished theory.
In 1853 he published his "Etymological Dictionary of the Romance Languages" and you can read the entry: 'tacco' (in the English translation) here, where he: 1) 'tacco' (heel) hence 'taccone - imagines the latter as the aug of the former, 2) f[rom] 'tacca' (notch) - imagines this the origin of tacco, 3) he does not suppose any PG Germanic unattested form or refer to any attested form, but just relates
These hypotheses were later proved wrong, but at the end of the 19th century his authority was undisputed and all European dictionaries accepted and reported the wrong etymology (E OED 1885, I 1907 etc...)
Walther von Wartburg is the greatest and the most authoritive philologist, his monumental work (FEW) is a milestone in Romance philology - no words are needed, you can see how he deals with the unattested *stakka (12 pages) and the attested g taikns. His hypotheses, with minor corrections after his death, are still accepted by all Romanists:
(ancien français (OF) estachier «ficher» ficher, du francique (f) *stakka «spieu»)
The reconstructed form *stakka (between g taikns and OF 'estach[i]e[r]') is hypothesized (following a very complex procedure) so that it obeys all known phonological (etc.) rules and is in accordance with cognate words.
I agree entirely with the following part of JEL's answer:
the spellings of 'attach' with a single tee in Middle English as well as in Old French were subject to a classicizing influence.
Using the spelling att- at the start of a word makes it look more like a classical Latin word, since the Latin prefix a(d)- triggers doubling of the following consonant when the d is lost. Classicizing influence would not lead to a spelling like dett- because Latin didn't have any prefixes with a form like de(d)- or de(b)- that would trigger gemination of a following consonant. Instead, it had the prefixes dē- and dis- (both of which contributed to the development of the English prefix de-).
In fact, this classicizing influence affects modern English spelling directly, not just through the medium of French. The word attune seems to have been coined in English. It certainly did not exist in Latin, since the word tune apparently originated in English as an "unexplained alteration of "tone" (Oxford Dictionaries). So it would never have been pronounced with a doubled consonant sound. But it is still spelled with a doubled consonant letter, because that's the normal spelling pattern in English for words that start with the prefix a(d)-; the classical spelling pattern that reflected Latin pronunciation has been taken into English even though it doesn't reflect English pronunciation.
In contrast, the word detune is spelled with a single t because the prefix de has no classical precedent for causing the following consonant to double.
The etymology of the second half of the words is actually a complicated question. The supposed Romance root "tacca" mentioned in JEL's answer is apparently not well-supported, and so the etymology that derives attach from this is now considered obsolete. (The cited OED entry for detach has a warning: "This entry has not yet been fully updated (first published 1895).")
If you instead look at the etymology in the OED entry for attach (which says "This entry has been updated (OED Third Edition, December 2015)") you will see a different account of the etymology:
The French verb [atachier] is usually analysed as an alteration (with prefix substitution: compare a- prefix) of Old French estachier to fasten, affix (an object) to another object (beginning of the 13th cent.; < estache STAKE n.1). However, this poses both chronological problems (since Old French estachier appears to be first attested later than attachier) and formal problems (since the unattested Germanic etymon of estache STAKE n.1 does not show gemination of the medial k, whereas the French forms presuppose it). In order to address the formal difficulties, it has been suggested that Old French estache was borrowed from an apparently unattested variant of the Germanic noun with expressive gemination.
In other words, currently most etymologists of Romance languages believe that the Romance ancestors of detach and attach, Old French destachier and atachier, are etymologically derived from Old French estachier, which is derived from a Germanic root reconstructed as *stakka.
They are different simply because they are derived from two different 'Old French' words:
source: Oxford (pp. 141, 649, since Middle English, from Old French estachier = fasten )
The French words are not derived from Latin but a from Proto-Germanic root, the difference can be more precisely explained because the second term was alreadyy derived from the first in Old French: de[s]tacher, and imported in these forms.
The original poster has been misled by incorrect comments: there is no prefix 'at-', and no derivation from Latin.
The English verb 'attach' has 2 t's because it derives from the French 'attacher'
(ancien français estachier = ficher, du francique *stakka = pieu)
The root of both words is Proto-Germanic stakô (='stake') or stakka[z] Gothic: 𐍃𐍄𐌰𐌺𐌰 ('staka') .
This form passed on to => (francique) Low-Frankish: *stakka => Old French: ['estaque / estache'].
From the substantive, the verb 'estachier' was formed (= 'to fasten with or to a stake') [It is evident that there is no prefix at all: 'estache' => 'estachier' (= 'stake' => to stake)], which became => Old French: 'attachier' => Modern French: attacher'
A prefix (de-) was used to form the second verb from the first 'de-'+ 'attacher' , => Old French: 'de[s]tacher' => ModernFrench: 'détacher' (Larousse).
It is confirmed by Oxford and was rightly said that the English words were formed from 'attacher' and 'detacher'.
This entry has not yet been fully updated (first published 1885)
...Etymology: < Old French atachier (modern attacher < à to, at + a radical [tacher] and is connected by Diez and Littré with the Genevese tache ... a round-headed nail, a tack n.1, q.v. Thus lit. ‘to tack to.’ See Diez, Littré, Skeat. ... 3. (cognate with)...The Italian equivalent is attaccare
The OED online is the original book printed from 1885 on, with minor corrections. The etymology currently accepted as correct is to be found in the book (which is updated every 20 years), and it reads:
I) Law: «arrest» < OF atachier. II) «fasten», II) «fall upon» < OF estachier . see stake.
This is confirmed by Etymonline:
mid-14c. (mid-13c. in Anglo-Latin), "to take or seize (property or goods) by law" , a legal term, from Old French atachier (11c.), earlier estachier "to attach, fix; stake up, support" (Modern French attacher, also compare Italian attaccare)
The original suggestion (by [Diez]) relating attach to tack was a wrong/wild guess made by an educated scholar.
tacco ( < tacken I tack) S taco ; I tacca , tecca < taccone S tacon; I taccar F tacher; attaccare S atacar F attacher
Étymol. incertaine. À côté de tache, on note la forme teche ... de même que techier est att. à côté de tachier (v. tacher), ce qui a amené Wartburg à formuler l'hyp. d'un empr. au got. taikns « signe » , avec évol. phonét. distincte de la diphtongue -ai-. Pour les formes en -a- (cf. ital. tacca « tache ») il conviendrait, selon lui, de remonter à un lat. tardif *takka, < taikns, par gémination de -k- sous l'infl. du -n et pour les formes en -e- (cf. aussi l'ital. tecca « petite tache ») à un type *tekka, issu peut-être detaikns par la réduction en got. de la diphtongue -ai- à ê, v. FEW t. 17, p. 296a-b.
Later it was agreed that a back-formation from a verb was more plausible:
tachier < VL *tagicare < L tangere « toucher » + tingere « colorer ». Therefore tache < tacher
note: I[talian], S[panish], F[rench], O[ld]F[french], T[reccani]