You must begin the application process at a US Mexican Consulate. Complete the form, present your photos and pay the fee. Upon arrival in Mexico, you will have 30 days to start the application process in Mexico. It takes about another 30 days until you have your Resident card. If you must leave the country before your card arrives, you will need get special permission to do so.
Please see our Directory for people that can assist you with this process.