Yes, I've done it [0]. It's not too hard, surprisingly affordable and not bad-tasting, but you are limited in what you can eat, and it takes some research/optimization that I think is too much for 90% of people.

First you need to learn how to get complete nutritional info. A lot of packaged food does not have a full nutritional profile on its packaging, and will omit many vitamins and minerals that could even be abundant in that particular food. To work around this you should use software like Cronometer [1] that allows you to look up nutritional info against various databases. In my experience the most comprehensive data source is the NCCDB, which has all important vitamins and minerals plus amino acid profiles. You can then estimate full nutritional info for most whole foods you buy in a store by converting the store-bought brand's nutritional info to the NCCDB info. For example if you buy oatmeal that says it has 150kcal per 0.5 cup, and the NCCDB info says 100kcal per X grams, you track your store-bought oatmeal as 1.5X grams per 0.5cup you eat. Note this only works for whole/single-ingredient foods, for processed foods with multiple ingredients the ratios of ingredients will vary too much from product to product for the NCCDB to be useful.

You should also get a food scale so that you can properly measure food that has its nutritional info based on mass rather than by volume. They're pretty cheap, and you can do before/after measurements to make it less tedious to measure small things.

Now that you can get full nutritional info for each whole food, the rest is an optimization problem across macros, micros, amino acids (important if you get a lot of protein from plant-bases sources), price/availability, and your personal preferences.

Here is an example of a set of foods I eat almost every day which gives you a very strong macro/micro base: 80g (1 cup) rolled oats, 1 cup unsweetened soy milk, 1 tbsp chia seeds, 1 container Oikos Triple Zero yogurt, 0.5 oz pumpkin seeds, 0.5 oz sunflower seeds, 2 mandarin oranges. Try entering that to Cronometer, you'll see it's about 800kcal and makes good progress in a lot of vitamins and minerals - relevant to the article, it already has 84% of the RDA of magnesium. You can easily max all other micros by eating a dinner consisting of fish, rice and beans, 1 carrot, and some broccoli - and still have room left over for additional macros (which will of course themselves contain extra micros) if you exercise.

Of course, this is much more cognitive work than the majority of people want to put in, and because it only works when you buy most of your food in the form of single-ingredients that you then prepare yourself, it's not compatible with a lifestyle of eating lots of prepared foods or dining out. However once you invest the up front time in learning how to do all this, it's not very hard to do, especially if you eat a consistent diet or combine things into set meals you can mix and match [2].

[0] The major exception is I usually don't hit 100% of the RDA for dietary Vitamin D. Dietary vitamin D in non-supplemental form (as found in milk and milk substitutes) is only present in very few foods - oily fish and sun-exposed mushrooms. I do eat these somewhat regularly but not enough to hit 100%. But I think as long as you get adequate sun exposure it's not a big deal.

[1] cronometer.com

[2] For example, in the example set of foods I provided, the rolled oats + soy milk + chia seeds are eaten together in the form of overnight oats almost every morning.