The gods of the CDC have spoken: to fly back to the U.S. from your Mexico City sojourn, you need proof of having tested negative for COVID. But how to go about getting a test, without losing a whole day of your vacation in the process?

As it turns out, it can be done. But you have to know the terrain—and be a bit savvy about it.

First, for those who haven’t been paying attention, the news out of CDMX lately vis-à-vis COVID has been heartening. Contagion rates, hospitalizations, coronavirus-related deaths: all continue to plummet, even as the city government inches forward with the colossal task of vaccinating the 21 million-plus souls that make up North America’s biggest metro area.

For travelers, this is welcome news. As of this writing, Mexico City is in semáforo amarillo—Code Yellow, in the system of COVID “traffic lights” established by Mexico’s Secretariat of Health. This means nearly all businesses, restaurants, tourist attractions, and even some bars and discos are now open, albeit with reduced capacity, and observers are predicting a return to Code Green by summer. Mask mandates remain in place, and chilangos (CDMX residents) are as scrupulous about following them as their urban counterparts north of the border.

As part of its plan to jump-start the city’s decimated tourist sector, in late February 2021 the Mexico City Government partnered with several local pharmacy chains to make COVID testing for travelers as painless as possible. While not glitch-free—this is still Mexico, after all—the system works more or less as intended, and is generally economical. Provided, that is, you know your way around, and that you make allowances for the snafus that are inevitably part of the game in Latin America.

Here’s a guide to walk you through the drill. Nota bene: plan ahead. In Mexico, mishaps have a way of filling up even the extra time allotted for their circumvention.

1. The Rules

In January 2021, the U.S. Centers for Disease Control mandated that all travelers flying to the U.S. from overseas must show proof of having tested negative for COVID before boarding their inbound flight—no exceptions. This proof can take the form of a negative result on an antigen or a PCR test, and must be dated no more than three days prior to the day of your flight. (E.g., if your return flight is on Saturday, you can get tested at any time on Wednesday, Thursday, or Friday.) Already fully vaccinated? Doesn’t matter. As of now, the CDC rule applies to all incoming travelers, regardless of their vaccination status.[i]

Now, if you’re staying at a high-end hotel, like the J.W. Marriott in Polanco or the Hilton Mexico City Reforma on the Alameda Central, it’s likely the hotel staff can arrange everything, right down to scheduling the test for you at a local clinic. If that’s your case, stop reading right now. For the lesser social castes, however, or those staying at an Airbnb, lining up a test is still necessary. In this case, proceed to step two.

2. The Reservation

The next task is making an appointment at one of the CDMX pharmacies that offer low-cost COVID testing. Here the most convenient option is Farmacias del Ahorro, which has branches in most of the colonias frequented by gringos. Their webpage allows you to reserve a time slot at the branch of your choice. (Note that these are antigen tests only; for a PCR test you need to go to a clinic.[ii])

A caveat, however: the website has a major glitch that can easily make hash of your plans.

The problem is that when you click on “Register for the Antigen Test” on the Farmacias del Ahorro webpage, the form that comes up doesn’t allow you to choose the pharmacy branch where you want to take the test. Filling out this form is thus effectively useless.

To get around this problem, CONNECT TO A LOCAL MEXICAN WIFI NETWORK AND SCAN THE WEBPAGE’S QR CODE. This should bring up the correct registration form. Be sure, however, that it enables you to choose a specific branch to administer the test. IF YOU DON’T CHOOSE A BRANCH, YOU DON’T HAVE AN APPOINTMENT.

Also, be sure to enter your legal name as it appears on your passport when you register. If the name on the test doesn’t match the name you’re traveling under, you won’t be allowed to fly.

3. The Pharmacy

In theory, choosing a pharmacy branch should be a cakewalk. However, if you don’t know CDMX’s geography, it can be surprisingly time-consuming. That’s because the branches on Farmacia del Ahorro’s website are listed by their alcaldías, which are the 16 territorial divisions that make up the capital city. Travelers unfamiliar with CDMX’s layout can easily spend an hour or more cross-checking the locations on Google Maps.

To make your existence easier, here’s an executive summary. For most travelers, the key alcaldías are the following:

Colonia Roma, Zona Rosa, Colonia Condesa –> Alcaldía Cuauhtemoc

Colonia Polanco –> Alcaldía Hidalgo

Centro Histórico –> Alcaldía Cuauhtemoc

Colonia San Ángel –> Alcaldía Álvaro Obregón

Colonia Coyoacán –> Alcaldía Coyoacán

If you’re staying in Condesa—probably the top gringo destination in CDMX—your closest option is the Farmacias del Ahorro at Av. Insurgentes Sur 410. If you’re in Colonia Roma, use either this branch or the one in the Zona Rosa at Av. Florencia 52. There’s also a branch at Calle Dr. Rafael Lucio 269, right across from the Hospital General de México in Colonia Doctores, but frequently it has no doctor in attendance.

Which brings us to our next point: to avoid foul-ups, it’s a good idea to make two appointments about an hour apart at two different branches. Mexican doctors can’t always be counted on to be where they say they’re going to be, so if you go the day of your test and there’s no doc in the house, you can still make it to another site.

Of course, unforeseen screw-ups being so integral a part of life in Latin America, it goes without saying you definitely shouldn’t wait till the last minute to undertake all this legwork.

4. The Test

The test itself is simple. You go, pay for your exam ($347 MXN, or about $18 USD), bring your ticket to the on-site doctor’s office, and wait. After the doctor shoves the swab up your nose, you’ll fill out a release form. Fifteen minutes later, he or she will provide you with both a paper copy of your results and a PDF, sent to your email. These are the documents you’ll present to the airline to obtain your boarding pass at the airport.

5. The Alternatives

If for whatever reason you can’t make it to Farmacias del Ahorro, Farmacia Benavides also offers antigen tests for comparable prices. The branches in the Zona Rosa (Av. Paseo de la Reforma 350), Roma Norte (Av. Insurgentes Sur 279), and Polanco (Calle Hipólito Taine 205) are the ones most likely to be useful to gringos, but unlike with Farmacias del Ahorro, you have to go in person to set up an appointment.

As an absolute last resort, Mexico City’s Benito Juárez airport now offers both antigen and PCR testing at Terminal 1, which is where most U.S. airlines have their counters. The three testing modules are located at Door 6 entering the terminal (24 hours), Gate F3 (3 a.m. to 11 p.m.), and at the entrance to the Camino Real Hotel (look for Tunnel 1, Door B; 7 a.m. to 11 p.m.).

Be warned, though: there are sometimes long lines at these test sites, and prices are at least double what you’d pay elsewhere in CDMX. You also need to get there at least four or five hours before your flight for the antigen test, while the PCR test has the usual 24-hour turnaround. And since no sane person would vouch for any establishment in Mexico’s being open the hours it’s supposed to be open, you avail yourself of these services at your own risk.

[i] Alternatively, you can show proof you’ve recovered from COVID, but since this requires documentation of a recent positive viral test, as well as a letter from a doctor or public-health official stating you were cleared to travel, this option is best pursued back in your home country, before you start your trip.

[ii] Some CDMX clinics that offer PCR tests are Olab, Jenner, Laboratorios Azteca, Chopo, and Labiomola. Prices run in the neighborhood of $100 USD, and turnaround times vary from 24 to 72 hours.