Herman Melville was born on August 1, 1819, in New York City; his father was a prosperous importer, his mother the daughter of Peter Gansevoort, a military hero of the American Revolution. When he was eleven his father failed in business, then died a little over a year later. The newly impoverished family relocated to Albany, where Melville worked successively as a bank clerk, farmer, and bookkeeper before trying his hand as a teacher in Pittsfield, Massachusetts. All these early ventures were unsuccessful, and in 1839 he signed on as a crew member on the trading ship St. Lawrence, and sailed from New York to Liverpool and back. Upon his return he resumed teaching, but two years later went to sea again aboard the whaling ship Acushnet.
When the Acushnet was in the Marquesas, Melville and a companion jumped ship and spent a month in the Taipi valley on Nuku Hiva. Brought back to Tahiti by an Australian whaler, Melville was taken ashore as a mutineer but escaped. For a time he worked in Honolulu, before enlisting in 1843 in the U.S. Navy; he sailed to Boston on the frigate United States and was discharged upon arrival. Once back home with his family, he began working on a somewhat embroidered account of his Nuku Hiva adventures: Typee (1846) became an instant success and was followed by Omoo, a similarly fictionalized recasting of his Tahitian misadventures. In 1847 Melville married Elizabeth Shaw, the daughter of the Massachusetts Chief Justice. They moved to Manhattan, and Melville wrote Mardi (1849), Redburn (1849), and White-Jacket (1850). In 1850 he met Nathaniel Hawthorne, whose writing he had already praised in an anonymous review; his relatively brief but intense association with Hawthorne was to be a pivotal event for him.
On a farm he had purchased near Pittsfield, Massachusetts, Melville wrote Moby Dick, which was published in 1851 to little success or acclaim. His subsequent works--Pierre, or the Ambiguities (1852), Israel Potter (1855), The Piazza Tales (1856), and The Confidence-Man (1857)--were marked by a frequently tortuous and obscure style that did little to restore the popularity Melville had enjoyed with his first books. His family regarded his mental health as precarious, and in 1856 he embarked alone on a trip to Europe and the Holy Land, financed by his father-in-law. In Liverpool he briefly visited Hawthorne, but the journey as a whole did not have the desired restorative effect. Back in America Melville tried his luck as a lecturer, without great success, and made a vain effort to secure a consular post.
During the Civil War Melville wrote a series of poems later published as Battle-Pieces and Aspects of the War in 1866. That year, he received an appointment as deputy inspector of customs at the port of New York, a job he was to hold for the next twenty years. In 1867 his son Malcolm died from a gunshot wound that was probably self-inflicted. During his years as customs inspector, Melville's literary energies were focused on a poem of epic length, Clarel, based on his impressions of the Holy Land and consumed with a spirit of religious doubt; it was published, at his uncle's expense, in 1876, but made little impression on the public. After his retirement he published some small volumes of poetry in extremely limited private editions, but the chief work of his later years was the novella Billy Budd, which remained unpublished until 1924. Melville died on September 28, 1891.