Bayley's mother died on March 28, 1828, and by 1830 the Bayleys had left their home at Mamaroneck and had moved back to New York, or at least nearer to it. In the autumn of 1828 or 1829, Bayley left for boarding school, spending some time at the Mount Pleasant Classical Institute in Amherst, Massachusetts. A classmate there later recalled, "he then had a great fancy for the sea, and actually obtained a commission of midshipman in the navy. When he appeared before us in his uniform preparatory to leaving school, I well remember our admiration and envy of the naval hero. But upon mature deliberation he reconsidered the matter, packed his uniform away, and devoted himself to his studies more earnestly than ever." For many years after, his friends called him by the nickname "the commodore." The same classmate recalled that "I do not remember that the commodore was ever counted in when there was a quarrel, for he was everybody's friend." Bayley kept up his friendships from this school until the end of his life, and regularly sent letters to class reunions even when he could not attend in person.