A machine for the preparation of pharmaceutical products has a pocket conveyor (8) provided with a plurality of pockets (33) each adapted to receive and hold a respective container (9), at least one operating station (34; 35; 36) to carry out an operation on the containers (9), and a transfer device (37) which is movable with rectilinear movement to transfer the containers (9) between the pocket conveyor (8) and the operating station (34; 35; 36) along a rectilinear guide (42; 46).