Mark Zuckerberg was the commencement speak for Harvard’s 2017 graduation, and he doled out some advice to the graduates.

SAN FRANCISCO — Mark Zuckerberg, Harvard’s most famous dropout, returned to the leafy college campus he left behind nearly 12 years ago for Facebook to make an urgent appeal to his generation, millennial to millennial: Don’t just seek out your own sense of purpose. Create a world in which everyone can.

“To keep our society moving forward, we have a generational challenge — to not only create new jobs, but create a renewed sense of purpose,” Zuckerberg told Harvard graduates on Thursday. “It’s not enough to have purpose yourself. You also have to create a sense of purpose for others.”

The commencement address, for which he prepared for weeks, was delivered in the pouring rain. It nodded to growing disillusionment by everyday Americans who have watched the gains of the economic recovery pass them by.

“When our parents graduated, purpose reliably came from your job, your church, your community,” Zuckerberg said. “But today, technology and automation are eliminating many jobs. Membership in communities is declining. Many people feel disconnected and depressed and are trying to fill a void.

“As I’ve traveled around, I’ve sat with children in juvenile detention and opioid addicts, who told me their lives could have turned out differently if they just had something to do, an after school program or somewhere to go. I’ve met factory workers who know their old jobs aren’t coming back and are trying to find their place.”

The remarks, delivered in suit and tie, not his customary gray T-shirt and jeans and at a podium without a teleprompter, focused heavily on harnessing this generation’s entrepreneurial spirit to push for big ideas…