How do you save Wrex on Virmire in Mass Effect Legendary Edition?

Quick answer: Finish the Wrex: Family Armor assignment before Virmire and pick the top replies, or have high enough Charm or Intimidate to unlock the blue or red talk option.
Show walkthrough (story spoilers)
Before Virmire: Family Armor
Talk to Wrex on the Normandy often until he mentions his family armor. Do the Wrex: Family Armor assignment and get it back for him. This earns his trust for the standoff.
Charm or Intimidate
Without the armor, you need a Charm or Intimidate check: the blue or red talk line on the beach. It needs a fairly high rank, around 8 in either skill. Passing it unlocks the Charismatic Steam achievement.
On the beach
With the armor done, pick the top reply each time, such as "I wouldn’t do this otherwise." and "We are." Or use the blue or red line if you have it. Wrex lowers his gun and stays in your squad.
If talks fail
Wrex is shot, by you or by Ashley if you signal her or the talk drags on. He stays dead for the rest of the trilogy, and his brother Urdnot Wreav leads clan Urdnot in his place. Wrex alive is a stronger ally in Mass Effect 3. See the Virmire walkthrough.
