How do I make a 0.5 M citrate buffer at pH 4.5?
There are many ways to make simple pH buffers like this one. As @Poutnik noted, preparation via titration works fine and in very commonly used. To illustrate how this is done, several possibilities are presented. Assume the desired buffer characteristics are pH = 4.5, concentration = 0.5 M, final buffer volume = 1 L, and the following reagent grade chemicals are available: citric acid, sodium dihydrogen citrate, disodium hydrogen citrate and 2 M NaOH solution. Also assume a laboratory quality pH meter is available and that the pH meter has been properly calibrated with buffers of 4.00 and 7.00, bracketing the desired pH of 4.5.  Before proceeding, it is useful to examine citric acid’s $\alpha$ dissociation fractions.

Brief refresher on $\alpha$ dissociation fractions.

Citric acid, denoted $\ce{H_3Cit}$, is a triprotic weak acid. The successively less protonated citrate species are $\ce{H_2Cit^-}$, $\ce{HCit^{2-}}$, and $\ce{Cit^{3-}}$. Since all the citrate species are in the same volume of solution, molar concentrations (denoted by the usual square brackets, e.g., $[\ce{H_3Cit}]$) are proportional to numbers of moles. Define $D$ as the sum of $[\ce{H_3Cit}] + [\ce{H_2Cit^-}] + [\ce{HCit^{2-}}] + [\ce{Cit^{3-}}]$. Then $\alpha_0$ is $[\ce{H_3Cit}]/D$, $\alpha_1$ is $[\ce{H_2Cit^-}]/D$, $\alpha_2$ is $[\ce{HCit^{2-}}]/D$, and $\alpha_3$ is $[\ce{Cit^{3-}}]/D$. The sum of the $\alpha$ values equals unity, as expected: every citrate species must be somewhere in the solution.

At any given solution pH, all four citrate species are present (though possibly at negligible concentration), as determined by the pH, the three acid dissociation equilibria and their associated equilibrium constants: $\mathrm{p}K_\mathrm{a1}$, $\mathrm{p}K_\mathrm{a2}$, and $\mathrm{p}K_\mathrm{a3}$. For citric acid, the $\mathrm{p}K_\mathrm{a}$ values are 2.13, 4.77, and 6.40. At any given solution pH, the $\alpha$ fractions are simply the proportion of total citrate that is in the relevant ionic or molecular species.

The screenshot below shows the $\alpha$ fractions up to pH = 8 (it is boring above pH = 8):



For a desired citrate buffer at pH = 4.5, the figure shows that only $\ce{H_2Cit^-}$ (green $\alpha_1$ curve) and $\ce{HCit^{2-}}$ (blue $\alpha_2$ curve) are present in significant concentrations. Furthermore, $[\ce{H_2Cit^-}]/[\ce{HCit^{2-}}] &gt; 1$.

Method 1

Weigh out an amount of citric acid equal to approximately 0.5 moles, i.e., about 91 g. Dissolve that, with stirring, in about 0.5 L of water in a large beaker. Be careful to not drop a magnetic stir bar into the beaker!  If 375 mL of 2 M NaOH solution were to be added, the pH would be about 4.76, which is a little too high. The reason is that 0.75 moles of $\ce{OH^-}$ would neutralize the first citric acid proton and lead to a roughly equimolar ratio between $\ce{H_2Cit^-}$ and $\ce{HCit^{2-}}$. This is too much added NaOH solution because $[\ce{H_2Cit^-}]/[\ce{HCit^{2-}}] = 1.82$, as is easily determined using the Henderson-Hasselbalch equation or the $\mathrm{p}K_\mathrm{a2}$ expression.

Add 250 mL of 2 M NaOH and then, with constant stirring and monitoring of the pH, slowly add more 2 M NaOH solution until the pH increases to 4.5. Finally, the last step is to add water until the final buffer volume is 1 L.

Method 2

Start by assuming $[\ce{H_2Cit^-}]/[\ce{HCit^{2-}}] = 2$, so the pH will be a little below the target value of 4.5, and weigh out about 71 g of $\ce{NaH_2Cit}$, i.e., about 1/3 mole. Likewise, weigh out 39 g of $\ce{Na_{2}HCit}$, i.e., about 1/6 mole. The total number of moles of citrate species is about 0.5. Dissolve the $\ce{NaH_2Cit} $ and $\ce{Na_{2}HCit} $, with stirring, in about 0.8 L of water in a large beaker. Then, with constant stirring and monitoring of the pH, slowly add 2 M NaOH solution until the pH increases to 4.5. The last step is to add water until the final buffer volume is 1 L.

What happens if a mistake is made and the pH is too high? Simply add a little more of the most acidic species, making sure it dissolves, and then titrate back up with NaOH solution. It can be helpful to have a lower concentration NaOH solution available, e.g., 0.1 M, either for this corrective procedure or for tweaking the pH.

Other possibilities include 1) citric acid plus trisodium citrate or 2) citric acid plus disodium hydrogen citrate or 3) sodium dihydrogen citrate plus trisodium citrate, but these are not considered further.