Are you sure you're constipated and not just making less poo? Are there gas, pain, or other sensations in your lower abdomen? Eating purer food like meat means less poo overall. If you're sure you're genuinely constipated, yes magnesium citrate will fix it. Take it easy, though. It won't take much - maybe 1/2 a teaspoon.
Are you eating dairy? Drop the dairy for now to make sure it's not part of the problem.
Are you drinking TONS of water, especially if new to this?
I'm prone to constipation, especially on SAD. I've learned to avoid dairy almost entirely except for hard, aged cheeses. And if I cheat and have a few slices of the magic endless pizza parade from work, I PAY for it. Apples, sweet potatoes and magnesium save me when I do myself in - for the fiber and electrolytes in the food as well.
Typically though, people find that if they get out of the gray zone (dairy, too much chocolate and wine, ice cream, etc.) and go strict high-fat primal (meat (and similar - eggs, seafood,bone broth), fruit, veggies, and a little nuts and berries on the side), there's a happier gut to be found. I NEVER have poo problems when eating huge amounts of red meat and coconut milk, tallow, avocados, nuts, etc. Sometimes poultry will stop at the station for a bit, but it always makes it on time, too.
Adjusting your macronutrient ratios may or may not be helpful, depending on the situation.
Steak, eggs, potatoes - fruits, nuts, berries and forage. Coconut milk and potent herbs and spices. Tea instead of coffee now and teeny amounts of kelp daily. Let's see how this does! Not really had dairy much, and gut seems better for it.