The mechanism of action of macrolides (e.g., erythromycin) is:
Macrolides such as erythromycin, azithromycin and clarithromycin belong to group characterized by large 14-, 15- or 16-membered lactone rings decorated with deoxy sugar moieties L-cladinose and desosamine that confer binding specificity. They lodge within the nascent peptide exit tunnel of the large ribosomal subunit. Bacterial ribosomes comprise small 30S and large 50S subunits; 50S contains 23S rRNA that forms the peptidyl transferase center and tunnel spanning subunit. Macrolides bind at nucleotides 2058 and 2059 of domain V of 23S rRNA near the peptidyl transferase center, partially occlud
Ref: Alberts et al., Molecular Biology of the Cell, 7th ed., Chapter 7: Macrolides Binding to 50S Ribosomal Subunit.