As “The Wanderer” was developed for the Zooropa album, it went through a number of name changes. It started as “The Preacher”, and later became “Wandering” and finally “The Wanderer.”
The song is described in the book, The Man Called Cash: The Life, Love and Faith of an American Legend by Steve Turner:
In February 1993 when Cash was in Dublin to play a concert with Kris Kristofferson, Bono invited him to Windmill Studios, where the band was recording with producer Brian Eno. As Cash later remembered it, they told him they were recording a track that was part of an experimental music project. The day before, Bono had written the words to a song he was calling “The Preacher” (it later became “Wanderlust” and finally “The Wanderer”). It was inspired by the Old Testament book of Ecclesiastes, in which the unnamed narrator systematically explores all avenues of fulfillment before concluding that everything is worthless unless people remember their Creator.
The book relates that Cash returned home after the sessions assuming that the track would never be used.
“The Wanderer” / “The Preacher” / “Wanderlust” is a different song than “Ellis Island” that Cash also worked with U2 on.
The roots of “The Preacher” may go back to the 1990 sessions in Berlin. In Bill Flanagan’s book, U2 At the End of the World it is mentioned that there was a familiar song recorded there:
There was a song recorded in Berlin that didn’t make the final sequence, in which Bono sang of wanting to “see and touch and taste as much as a man can before he repents.”
It is likely that the lyrics to “The Preacher” had been around for a bit when Bono pulled them out when Cash came to town.
“Wanderlust” is also mentioned as a title of the song in BP Fallon’s book, Faraway So Close. In the book Fallon writes:
And then Bono is elaborating on the song Johnny Cash has cut with U2. “You know we wrote it in a day because Johnny Cash was coming in to Dublin and we had this song provisionally titled “Wanderlust” – which we figured would suit Johnny Cash — and we thought if we were ever going to get Johnny Cash to sing it, this is the time.