There is a tradition that Eliyahu (Elijah the Prophet) will come before Moshiach, to inform the world of the advent of Moshiach. Is this showing of Eliyahu a mandatory pre-requisite for Moshiach?
The Talmud relates: [Sanhedrin 98a]
Once, Rabbi Joshua met Moshiach and asked him: `When are you going to come?'
Moshiach replied: 'Today!'
Rabbi Joshua then met Eliyahu, who asked him: `What did he (Moshiach) tell you?'
Said Rabbi Joshua: `He lied to me, for he told me that he is coming today, but he didn't come!'
Said Eliyahu: `He didn't lie, but this is what he really meant: He will come "Today, if you hearken to the voice of G-d." [Psalms 95:7]
Maharsha explains that if Moshiach comes today, we assume that Eliyahu came yesterday to the Supreme Beth Din (in Tiberias).
Another explanation is that if we merit, and Moshiach comes sooner (before the appointed time), he may then come on his own before the revelation of Eliyahu. This is presented in Krayti U'playti [by Rabbi Yonason Eibschutz]
Rambam posits [Hilchos Melachim 12:2] that it is not a certainty that Eliyahu must come before Moshiach. Although some Sages maintain that before the advent of Moshiach, Eliyahu will appear, yet, there is no definite basis for this.
This poses a difficulty, inasmuch as the Talmud states [Eiruvin 43b] that Eliyahu will come first, and as is seen in Tanach [Malachi 3:23] "Behold I send unto you Eliyahu the Prophet."
How do we reconcile these two statements re: the coming of Eliyahu?
The answer is seen in the timing of Moshiach, as the Talmud cites the verse: [Isaiah 60:22; Sanhedrin 98a] "In its time will I hasten it" - If Jews do not merit, Moshiach will come in his appointed time; but if they merit, then Moshiach will come sooner, in haste.
Rambam holds that there is an order to the coming of Moshiach, that Eliyahu comes first to foretell of his coming. This, however, is effective only when Moshiach comes in his appointed time. But when Jews merit and the redemption is hastened, as expressed in [Song of Songs 2:8] "He is leaping over the mountains, skipping over the hills" - G-d then changes the order, as a sign of His love for Jewish merits and good deeds. This is expressed in the Rambam's concise words.
The Sages note that Eliyahu comes first, to convey the news of Moshiach; yet, this is not definite. For, perhaps G-d will have mercy and bestow His holy spirit upon the Jews to serve Him with a full heart; then He will swiftly bring Moshiach without the need for Eliyahu's message. [Otzar Blum, Sanhedrin ibid.]
Source: Sichos in English