Cut the butter/dairy free butter into small cubes and add to the bowl of an electric mixer (or just a large bowl if mixing by hand).
Sieve the gluten free flour into the bowl and rub the butter and flour together with your fingers until the mixture resembles breadcrumbs.
Add the xanthan gum, brown sugar and salt. Whisk to combine.
Put the bowl back onto your electric mixer and use the dough hook attachment. Gradually add the beaten egg as you mix on a low speed. Or, if mixing by hand, just use a fork to incorporate the egg through the mixture.
Add the cold water 1 tablespoon at a time, continuing to mix on a low speed/with a fork until the mixture resembles a slightly sticky dough. NOTE: I have found that when using dairy free butter, less water is needed so would advise adding 1 teaspoon at a time in this case until the desired slightly sticky texture is achieved.
Use your hands to bring the mixture together into a ball of dough, but avoid handling much more than this. Wrap the ball up in cling film or foil and place in the fridge to chill for 30 minutes.
Preheat the oven to 180°C/160°C fan.
Once the dough has chilled, roll it out on a lightly floured surface or between two sheets of baking paper. It should be approx 3-5mm thick and big enough to cover your tin with a slight overhang.
Carefully lay the dough over the pie tin. Push the pastry down into the base and sides so it closely lines the tin, then slice away the overhanging pastry with a sharp knife. Prick the base a couple of times with a fork.
Place some baking paper over the pastry-filled tin and cover with baking beans, rice, or anything ovenproof that will weigh the pastry down evenly.