Bettmann / CORBIS A sample of space food carried on the Apollo 11 lunar mission. The package contains beef with vegetables

You have a degree in astrophysics and you know how to fly a jet. You've endured years of preparation and training, logged thousands of hours of flight time and even survived NASA's terrifying "vomit comet" weightlessness test. Now you're up in space for the very first time, floating around the shuttle's cabin, and as you look out of the window, you realize something: you're hungry. What are you going to eat? (See pictures of Armstrong and Aldrin on the moon.)

Initial voyages into space introduced questions scientists had never before considered. Could an astronaut swallow food in zero gravity? Would he choke? Would crumbs float into the shuttle's instruments and break something? To keep things simple, astronauts on the Project Mercury and Gemini missions ate pureed foods squeezed out of tubes. "It was like serving them baby food in a toothpaste container," explains Vickie Kloeris, NASA's Space Food Systems Laboratory manager. John Glenn was the first person to eat in space; in 1962 he ingested applesauce and reported relatively easy digestion.

But these early tube meals were unappetizing, and astronauts dropped too many pounds. "We know that astronauts have lost weight in every American and Russian manned flight," wrote NASA scientists Malcolm Smith and Charles Berry in a 1969 Nutrition Today article. "We don't know why." Feeding people in space was not as easy as it looked. (Watch TIME's video "Why America Hasn't Gone Back to the Moon.")

Floating around in space isn't as relaxing as it might sound. Astronauts expend a lot of energy and endure extreme stresses on their bodies. Their dietary requirements are therefore different from those of their gravity-bound counterparts on Earth. For example, they need extra calcium to compensate for bone loss. (Bones tend to regenerate slower in space, and the loss of mass begins almost immediately after takeoff). A low-sodium diet helps slow the process, but according to Kloeris, that's easier said than done. "There are no refrigerators in space, and salt is often used to help preserve foods," she says. "We have to be very careful of that."

By the Apollo missions, NASA had developed a nutritionally balanced menu with a wide variety of options ranging from tuna salad to corn chowder. Of course, all the items were freeze-dried, dehydrated or "thermo-stabilized" (heat-treated to kill bacteria), and they didn't look like regular food. Meals were rehydrated and served in a pouch, allowing them to be eaten with a spoon. The Apollo 8 crew celebrated Christmas Day 1968 by eating thermo-stabilized turkey, gravy and cranberry sauce. Neil Armstrong and Buzz Aldrin became the first men to eat on the moon when they consumed ham-salad sandwiches, rehydratable beverages and "fortified fruit strips" during their lunar excursion. The Apollo 11 astronauts actually ate four meals on the moon's surface; their resulting waste is still in the lunar module they left behind. (See pictures of the Apollo 11 astronauts partying upon their return to Earth.)

Today, the most elaborate outer-space meals are consumed in the International Space Station (ISS), where astronauts enjoy everything from steak to chocolate cake. They even have a small beverage chiller that can serve cold drinks. The ISS is a joint venture between the U.S. and Russia, and diplomatic guidelines dictate the percentage of food an astronaut must eat from each country. NASA's food laboratory has 185 different menu items, Russia offers around 100, and when Japan sent up its first crew member in 2008, about 30 dishes came with him. Kloeris says that the freeze-dried shrimp cocktail, served with horseradish-infused powdered sauce, is the most popular dish.

Due to dietary restrictions and storage issues, astronauts still can't eat whatever they want whenever they feel like it. The space station operates on a 16-day menu cycle, and each astronaut is allotted two cases to fill with any type of non-perishable goods, such as Pringles or M&Ms. Sometimes NASA sends up a bonus item, like a birthday cake.

In 1965, Gemini 3 astronaut John Young surprised his crew members when he pulled out a corned-beef-on-rye sandwich purchased from a Florida deli. Pizza Hut "delivered" a vacuum-sealed pizza to the Mir space station in 2001, and ISS member Peggy Whitson requested a pecan pie in 2002. Tortillas have been on every mission since 1985, when Mexican scientist Rodolfo Neri Vela brought them onboard a space-shuttle mission. In fact, NASA now provides astronauts with their own partially dehydrated tortillas made by the same company that supplies Taco Bell.

In 2008, NASA astronaut and ISS crew member Sandra Magnus became the first person to try to cook a meal in space. It took her over an hour to cook onions and garlic in the space station's food warmer, but she managed to create a truly delicious entrée: mesquite grilled tuna in a lemon-garlic-ginger marinade  eaten from a bag, of course.

Most of the dishes served on the original Apollo flights have been improved, altered or completely discarded in favor of new items. The famous freeze-dried ice cream was created on request for an Apollo 7 crew member, but the astronauts disliked it so much that it has never been used again. A few years ago, NASA tried to resolve complaints about fish-based dishes smelling "too fishy," but their solution, thermo-stabilized swordfish in tomato sauce, tasted so bad that some astronauts refused to eat it. But despite all the setbacks and unappealing concoctions, there is still one food item that has made it onto every menu and that every astronaut seems to enjoy: Tang.

Read TIME's cover story on the moon landing.

See pictures of Apollo 11's liftoff.