This post is a contribution from Pavan Kumar, an engineer with the SharePoint Developer Support team.
As in SharePoint 2007 and 2010, one of the ways to achieve this is to use FeatureStapling. Below are the steps to be followed to get this working.
Create a SharePoint 2013 Empty project in Visual Studio 2012 and give it a name (e.g., ChangeMySiteMaster).
Provide your MySite Host URL and choose to deploy this as a farm solution.
Add a new Module from Visual Studio 2012 SharePoint item templates to the project.
By default, MySites use mysite15.master as its default master page. This can be found under 15\TEMPLATE\FEATURES\MySiteMaster\mysite15.master. Copy this file and add it to the project you created. Rename it to CustomMySite.master and modify this file per your needs.
Delete Sample.txt available in the Module and edit Elements.xml file such that it looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Module Name="MasterPage" List="116" Url="_catalogs/masterpage" Path="MasterPage" RootWebOnly="TRUE">
<File Url="CustomMySite.master" Type="GhostableInLibrary"/>
Add a new feature to the project and add a feature event receiver to it. Ensure that module is added to the feature.
Add below code in FeatureActivated event of EventReceiver.cs.
Add below code in FeatureDeactivating event of EventReceiver.cs.
Create another farm level feature. Name it as MySiteFarmStapler. Add a new empty element to the project and name it as ML_ApplyCustomMasterPageStapler. Add the following markup to the XML.
<FeatureSiteTemplateAssociation Id=<GUID from EventReceiver.cs>" TemplateName="SPSPERS" />
Add the module to Stapler feature.
Save all the files and deploy. Login to your personal site and activate the feature from Site collection features. Personal sites created henceforth will have the new master page applied to it.
Did you mean to add the same module MasterPage to the MySiteFarmStapler or was it supposed to be the new ML_ApplyCustomMasterPageStapler instead?