A good starting point to aim for is about 18 months before you would start the program, or 6–9 months before the applications are due.
In the first few months of the process, research programs and study for any standardized exams you might need.
You can then begin writing your personal statements and statements of purpose, as well as contacting people to write your letters of recommendation. Ensure that you give recommenders plenty of time to complete their letters (ideally around 2–4 months).