CAMBRIDGE, Mass. — Science is worthless if it isn’t motivated by basic human values and the desire to help people, Apple CEO Tim Cook told graduates of the Massachusetts Institute of Technology on Friday, urging them to use their powers for good.

In a commencement address, Cook — who as Apple’s chief executive since 2011 has overseen the rollout of the iPhone 7 and the Apple Watch — said the company is constantly looking for ways to combine tech with a sense of humanity and compassion.

“Whatever you do in your life, and whatever we do at Apple, we must infuse it with the humanity that we are born with,” said Cook, who previously served as chief operating officer and headed the Macintosh division.

“That responsibility is immense. But so is the opportunity,” he said.

Cook said Apple wants to make products that help people. As examples, he cited iPhone technology that can help a blind athlete run a marathon and an iPad that connects an autistic child to the world around them.

“When you keep people at the center of what you do, it can impact,” he said.

Cook said he isn’t worried about artificial intelligence giving computers the ability to think like humans.

“I’m more concerned about people thinking like computers without values or compassion or concern for the consequences,” he said. “That is what we need you to help us guard against. Because if science is a search in the darkness, then the humanities are a candle that shows us where we have been and the danger that lies ahead.”

Cook also urged graduates to resist becoming cynical.

“The internet enabled so much and empowered so many, but it can also be a place where basic rules of decency are suspended and pettiness and negativity thrive,” he said.

“Don’t let that noise knock you off course. Don’t get caught up in the trivial aspects of life. Don’t listen to trolls, and don’t become one. Measure impact in humanity; not in the likes, but the lives you touch and the people you serve.”