Why do we say Shalom Aliechem in Kiddush Levanah? And what should one do if there are no other people around (or not enough people around)?
The Original sorce for this Minhag is a Maseches Sofrim.
ואומר לחברו שלש פעמים שלום, וילך לביתו בלב טוב
The reasons given are:
- The Mahril based on the Gemara in Sanhedrin 42A says since it is such a great Mitzvah it is as if we are greeting the Shechina.Therfore when we say Shalom Aleichem we are in a sense greeting the Shechina.
- Matteh Moshe(540) adds to his Rebbi's reasoning that after wishing bad upon our enemies we are telling Hashem that these people are not included among those whose downfall we seek.
- A third reason given is just like after making a Bracha (blessing) on food, we partake of it so to here after we make a Bracha on the moon we partake of it by use its light to identify a friend.
In response to what to do if there is not enough people around the Mateh Moshe says you greet one person three times. The Rebbe of the Mahril say that if you have three people you say to one friend twice ‘Shalom Aleichem’ and to the other once.
Since the first question was answered already I will address the second one only.
The Avnei Yashfei 3:50:3 writes that if one says kiddush levana alone there is no inyan to search out for someone to say shalom aleichem since he said the passuk Tipal aleiheim and no one heard him(see @simchas Torah answer -Mattaeh Moshe reason).He adds by saying if one said it with a tzibbur even though he said that passuk quietly ,the fact that the tzibbur knows he says the passuk he still should say shalom aliechem.