The ribosome builds proteins by joining together amino acids in an order determined by messenger RNA. Here, we report on the design, synthesis, and operation of an artificial small-molecule machine that travels along a molecular strand, picking up amino acids that block its path, to synthesize a peptide in a sequence-specific manner. The chemical structure is based on a rotaxane, a molecular ring threaded onto a molecular axle. The ring carries a thiolate group that iteratively removes amino acids in order from the strand and transfers them to a peptide-elongation site through native chemical ligation. The synthesis is demonstrated with ~10(18) molecular machines acting in parallel; this process generates milligram quantities of a peptide with a single sequence confirmed by tandem mass spectrometry.