Josh Miller/CNET

Apple CEO Tim Cook said Sunday he's "heartbroken" by the "insanity" of legislative inactivity regarding gun violence in the US after two mass shootings in two cities within 24 hours left 30 dead.

"I'm heartbroken about what's happening in my country," Cook said in tweet Sunday. "The definition of insanity is doing the same thing and expecting different results. It's time for good people with different views to stop finger pointing and come together to address this violence for the good of our country."

I'm heartbroken about what's happening in my country. The definition of insanity is doing the same thing and expecting different results. It's time for good people with different views to stop finger pointing and come together to address this violence for the good of our country. — Tim Cook (@tim_cook) August 4, 2019

A shooting Saturday at Walmart in El Paso, Texas, initially killed 20 people and wounded more than two dozen. On Monday morning, another victim died, bringing the death toll to 21. A shooting early Sunday in Dayton, Ohio, left 9 dead and 27 injured.

Cook is no stranger to voicing criticism of government activity he sees as detrimental to the US. In 2017, Cook spoke up against President Donald Trump's effort to close the US to immigrants from predominantly Muslim countries, telling employees in a memo that, "It is not a policy we support."

A year earlier, Cook was among more than 90 business executives who spoke out against a North Carolina law that would force transgender students to use school toilets "inconsistent with their gender identity."

The number of mass shootings across the US so far in 2019 has outpaced the number of days this year, according to a gun violence research group. There have been 251 mass shootings in the US this year as of Sunday, which was the 216th day of the year, according to data from the nonprofit Gun Violence Archive, which tracks every mass shooting in the country.

Originally published Aug. 4 at 12:57 p.m. PT

Update, Aug. 5 at 9:40 a.m. PT: Updates the death toll in El Paso.