Speaking to MIT's 2017 graduating class on Friday, Apple (APPL) CEO Tim Cook said he continues to grapple with technology's role in shaping our lives. 

Cook began his speech by recalling when he met with Pope Francis in January. The Pope sized up technology's growing importance as being a double-edged sword, Cook said. 

"[The Pope] knew an unbelievable amount about technology," Cook told the audience. "He had thought deeply about it, its opportunities, its risks and its morality. He expressed a shared concern...never has humanity had so much power over itself, yet nothing ensures that it will be used wisely." 

Technology is mostly used as a force for good, Cook reasoned, but its "adverse consequences" are also spreading at the same time. 

"The consequences are spreading faster and cutting deeper than ever before," Cook said. "Threats to security, privacy, fake news and social media that becomes anti-social. Sometimes the very tech that's meant to connect us, divides us." 

"Technology alone isn't the solution. Sometimes it's part of the problem." -@Apple CEO @tim_cook at @mitcommencement #MIT2017 pic.twitter.com/0ijY5VSWDV

— MIT Sloan (@MITSloan) June 9, 2017

Apple is a holding in Jim Cramer's Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells AAPL? Learn more now.

Cook said it's critical for Apple, the world and younger generations to practice decency, kindness and empathy, particularly in the face of threats that attempt to "make you cynical." Technology also has to be "infused with kindness," he added. The internet has empowered and connected many people, but it has also become a place where basic rules of decency are sometimes suspended, Cook noted. 

"I'm not worried about AI making computers think like humans," Cook explained. "I'm more worried about people thinking like computers." 

Cook also talked about when he joined Apple in 1998 and how it changed his outlook on life. When Cook arrived, "something clicked" and he was immediately inspired by former CEO Steve Jobs' passion for serving humanity.

"Steve and Apple freed me to throw my whole self into my work," Cook said. "When you work toward something greater than yourself, you find meaning and purpose." 

MIT said in a statement that it selected Cook to be its commencement speaker because he's a "trailblazer" that runs one of the most influential companies on the planet. In his speech, Cook noted that Apple and MIT share similar goals of solving "hard problems" and searching for new ideas. 

For the second time in a week I'm waiting for @tim_cook to hit the stage! Today at #MIT2017 -- congratulations graduates! pic.twitter.com/fbdvTCInf9

— Eddy Cue (@cue) June 9, 2017

Two weeks ago, Facebook (FB) CEO Mark Zuckerberg delivered his own commencement address to Harvard graduates in which he talked about the need to provide everyone with a purpose.

More from Stocks

CHART: Here's How Much Apple Stock Has Lost in Value in the Last Five Days

CHART: Here's How Much Apple Stock Has Lost in Value in the Last Five Days

Wall Street Is Totally Forgetting Apple Will Be Giving Away Tons of Cash in 2018

Wall Street Is Totally Forgetting Apple Will Be Giving Away Tons of Cash in 2018

United Technologies Tops Target on Strong Aerospace Business

United Technologies Tops Target on Strong Aerospace Business

How Did Caterpillar Get Its Name?

How Did Caterpillar Get Its Name?

Alphabet, Caterpillar, Coca-Cola and Amazon - 5 Things You Must Know

Alphabet, Caterpillar, Coca-Cola and Amazon - 5 Things You Must Know