Our Sages taught: "There will be no difference between the current age and the Messianic era except the emancipation from our subjugation to the gentile kingdoms."
The simple interpretation of the prophets' words appear to imply that the war of Gog and Magog will take place at the beginning of the Messianic age. Before the war of Gog and Magog, a prophet will arise to inspire Israel to be upright and prepare their hearts, as Malachi 3:22 states: 'Behold, I am sending you Elijah.'
He will not come to declare the pure, impure, or to declare the impure, pure. He will not dispute the lineage of those presumed to be of proper pedigree, nor will he validate the pedigree of those whose lineage is presumed blemished. Rather, he will establish peace within the world as ibid. 3:24 continues: 'He will turn the hearts of the fathers to the children."
There are some Sages who say that Elijah's coming will precede the coming of the Mashiach. All these and similar matters cannot be definitely known by man until they occur for these matters are undefined in the prophets' words and even the wise men have no established tradition regarding these matters except their own interpretation of the verses. Therefore, there is a controversy among them regarding these matters.
Regardless of the debate concerning these questions, neither the order of the occurrence of these events or their precise detail are among the fundamental principles of the faith. A person should not occupy himself with the Aggadot and homiletics concerning these and similar matters, nor should he consider them as essentials, for study of them will neither bring fear or love of God.
Similarly, one should not try to determine the appointed time for Mashiach's coming. Our Sages declared: 'May the spirits of those who attempt to determine the time of Mashiach's coming expire!' Rather, one should await and believe in the general conception of the matter as explained.