Tim Cook has been criticized in his six years at the helm of Apple as being short on the kind of vision for which founder Steve Jobs was renowned; for setting too modest a pace of innovation; for fighting back against the U.S. government when it demanded that Apple unlock iPhones in criminal investigations.

Yet in his tenure, Apple has remained strongly profitable, adding to a cash pile that’s now reached $257 billion. He is quick to point out all the ways in which it hasn’t been a laggard in artificial intelligence, and earlier this week he finally acknowledged the long-held rumors that Apple is working on autonomous cars. Cook himself has stepped out quite publicly on a series of critical issues, from his personal journey as a gay executive to President Trump’s immigration ban and withdrawal from the Paris climate accord.

He sat down with MIT Technology Review in the Social Machines group at the MIT Media Lab, on a day of touring the campus and meeting with researchers and students ahead of his June 9 commencement speech. Here is an edited transcript of the interview.

At your recent developers’ conference there was a surprising amount of discussion of artificial intelligence—much more than at prior conferences.

AI is profound, and we are at a point—and it will get better and better over time—where the GPU is getting so powerful there’s so much capability to do unbelievable things. What all of us have to do is to make sure we are using AI in a way that is for the benefit of humanity, not to the detriment of humanity.

Do you worry about that?

Yes, I do. I don’t worry about Apple doing it—I think we have our head sewn on right—but I do worry about it broadly. I worry that there will be a tendency on things that require human judgment. I worry that some folks may not think about that, and just think about the process of automating it, or automating it without the human element of it that’s so important … and that won’t be good for humanity.

Broadly, when technological advancements can go up so exponentially, I do think there’s a risk of certain people losing sight of the fact that technology should serve humanity and not the other way around. We see examples of that today.

Such as?

Fake news, right? Privacy. Security. But you could also extend it to the trolls on some social networks. They have sort of been given a megaphone. And I don’t mean people who have a difference of opinion, because I think that’s so important in a democracy. It’s occurring at many different places and putting a lot of tension on our social fabric.

There was a lot of AI talk this week, but Apple is often portrayed as playing a game of catch-up on this technology, behind companies like Google, Amazon, and Microsoft. How do you respond to that?

We typically don’t talk about something until we are about to ship. Not just for AI, but for anything: the comparison is generally what we are shipping compared to what someone else is talking about that is going to happen sometime in the future. A lot of people sell futures, I guess is the way to think about it. They have various reasons for doing that. I don’t criticize any of that; it’s just not who we are. At the developer conference this week, everything [we talked about] is shipping this year. So we’re not going through things that we’re going to do in ’19, and ’20 and ’21. It’s not because we don’t know that. It’s because we don’t want to talk about that.

People don’t think about well-integrated machine learning. They don’t even know it’s there. The battery lasts longer in your iPhone because of machine learning. There are a ton of things in [an iPhone] today that you wouldn’t think ‘Oh, that’s machine learning’—a whole list of things. We’ve never felt a need or like the consumer really wanted us to lay out the big matrix—“Here are all the ways that we use machine learning”—because it’s not something people care about. We care because we are in the techie sphere, but the user doesn’t care. They just want it to work.

How does the iPhone battery use machine learning?

The power management system is learning your usage and scheduling certain things to occur at times to maximize your battery life. Apple Music is learning something about you in order to decide what to play next, and maybe what to recommend and what to put on your playlist today. There’s image recognition in photos.

Let’s move from the technology in the iPhone to how it’s made. In the future, would Apple manufacture iPhones or other products in the U.S.? And what would that kind of manufacturing look like?

We manufacture in the U.S. today. We do it through third parties. If you think about the iPhone today, the glass is manufactured by Corning in Kentucky. There are significant amounts of silicon within the iPhone, and that’s manufactured in various different states. The equipment that’s used in the manufacturing processes, both in semiconductors and all the way through final assembly, is actually made in two or three dozen states. The number of manufacturing jobs we’ve created in the U.S. is 50,000 or 60,000.

The way we look at manufacturing is this: the U.S.’s strategy should be to skate where the puck is going, not where it is. The right focus for the U.S. is on advanced manufacturing—something that requires innovation. Robots are going to, over time, do the bulk of assembly. It probably doesn’t make sense for the country to establish policies and community [colleges] and vocational schools around something that is going to go in that direction.

We’ve already created 1.5 million jobs in the U.S. among app developers. This is the largest-growing job segment in the United States. If you think about it, it essentially didn’t exist prior to 2008.

When you look at where app developers are coming from, there are some demographic groups that aren’t represented that well. So a couple of weeks or so ago we launched a free Swift app development curriculum. We had partnerships immediately with several community colleges to begin teaching that in the fall to people in places where app development hasn’t taken hold—in Alabama, Houston, Texas, Ohio. They are kind of all over.

And we firmly believe that for any kid in public or private school, coding should be required. And not just for one year. It should just be like your language class and other classes where you take a more advanced class every year and go up the ladder. Whether you are going to work in retail or health care or in hospitality or in technology or manufacturing or finance, it would be really helpful to know how to code.

It would be good for Apple if more people were coding apps for your phones, but you have recently taken some positions that are less clearly tied to making a profit by making things for people to buy. For example, pledging to remain committed to the Paris accord on the reduction of greenhouse gases after President Trump decided the U.S. will leave it. Why do that?

My simple view is that people should have values, and because companies or organizations are nothing more than a collection of people, by extension, companies should have values. Those values are integral to making decisions on a daily basis, the thousands of things that come your way. We have a responsibility to create jobs in the communities we are in. We are an American company and we deeply love America, and I do feel we have an obligation to create jobs in America. In addition to that, we feel it’s a responsibility not only of American companies but companies everywhere to reduce their carbon footprint. Our commitment, which we set several years ago, is to run Apple on 100 percent renewable energy. We are proud now that we’ve made it to 96 percent worldwide. We are at 100 in the United States and 100 in China, our two largest markets. We’ve now gone beyond our company into partners that we work with, driving people who manufacture on our behalf to run their operations with 100 percent renewable energy … We are putting a huge two-gigawatt solar facility in China, and they’ve been incredibly receptive to it. We feel that one of the things that has increased the receptivity was the Paris agreement. They’ve decided they are going to make a significant reduction in carbon. We felt that it was really important to stay in that agreement because we see that a lot of countries out there are changing their behavior because of the agreement.