Temporary charisma buffs will make it possible to get a lot more settlers according to this steam thread
Charisma boosting gear also increases the max, the calculation is 10+CHA stat(maximum of 11 with bobblehead)+CHA bosting gear/drugs=max pop, though there are some conflicting reports about the longevity of that solution
This reddit thread also confirms going over 22 but reverting to normal when going back :
I had the same thing with vanilla. If you go back to the settlement it will revert to 10+CHA. The number keeps increasing if your out. Then it remembers it can only have so many and the institute comes for them (fast traveled back and syths were attacking so it is headcannon now)
The number is 10 + 1 per charisma point as written here:
Successful settlements need four critical things: beds, food, water, and defense. In the same respect, power is required to meet these needs beyond the most basic sense, especially for defense. There is an easy and quick way to understand how much of each you need:
- Beds: One per settler (max of 10 settlers plus 1 settler per Charisma point).
- Food: One food per settler.
- Water: One water per settler.
- Defense: One point per settler, although more is more helpful.
- Power: Add all of the power consumption things you need running, that’s the required power.
As noted, you’ll probably have a max of 11 to 20 settlers, depending on your build.
Seems the defense's value needs to be higher for a safe settlement, as per the comment from DCShannon :
You want enough defense to cover you food + your water. The number of settlers seems irrelevant. Keeping the defense over this value has resulted in entire playthroughs without a single attack on a settlement.
So make sure you have enough water, food and defense with at least 1 charisma to get up to 11 and more.
So the max should be 21 as it is possible to get a SPECIAL over 10, with charisma at 11, that would make possible to have 21 settlers with the same amount of beds, food, water and defense.