Open sesame
"Open sesame" (French: Sésame, ouvre-toi; Arabic: افتح يا سمسم)  is a magical phrase in the story of "Ali Baba and the Forty Thieves" in Antoine Galland's version of One Thousand and One Nights.  It opens the mouth of a cave in which forty thieves have hidden a treasure.

Etymology
The phrase first appears in Antoine Galland's French translation of  One Thousand and One Nights (1704–1717) as Sésame, ouvre-toi (English, "Sesame, open yourself"). In the story, Ali Baba overhears one of the 40 thieves saying "open sesame". His brother later cannot remember the phrase, and confuses it with the names of grains other than sesame, becoming trapped in the magic cave.
Galland's phrase has been variously translated from the French into English as "Sesame, open", "Open, sesame" and "Open, O sesame".Sesame seeds grow in a seed pod that splits open when it reaches maturity, and the phrase possibly alludes to unlocking of treasures, although it is not certain that the word "sesame" actually refers to the sesame plant or seed.Other theories include:

Sesame is a reduplication of the Hebrew šem 'name', i.e. God, or a kabbalistic word representing the Talmudic šem-šāmayīm ("shem-shamayim"), 'name of heaven'.
Sesame is connected to Babylonian magic practices which used sesame oil.

Classification
Open sesame has been classified by Stith Thompson as motif element D1552.2, "Mountain opens to magic formula".

See also
Abracadabra
Barbarous names
Hocus pocus

Notes
Bibliography
(in English) Paul Haupt, "Open Sesame" in Beiträge zur assyriologie und semitischen Sprachwissenschaft 10:2, 1927, p. 165ff.  Originally presented at the meeting of the American Oriental Society, Washington, April 15, 1916.