Preheat oven to 350 degrees F (175 degrees C). Rinse the chicken, inside and out, and pat skin dry with paper towels.
Squeeze juice from lime halves over the outside of the chicken and place the squeezed halves in the cavity. Sprinkle cavity with minced garlic. Stir salt, black pepper, and rosemary in a small bowl and season the outside of the chicken with the mixture.
Place chicken upright in a roasting pan, with the beer can inserted into the cavity far enough so the chicken doesn't fall over. Place the onion into the neck cavity to block steam from escaping. Pour water into the bottom of the pan.
Roast the chicken upright in the preheated oven until sizzling and an instant-read meat thermometer inserted into the thickest part of a thigh reads 180 degrees F (80 degrees C), 1 1/2 to 2 hours. Baste occasionally with pan drippings. Let chicken cool for about 10 minutes before serving.