Hours earlier, a Spanish court issued a preliminary ruling in favour of his extradition to the United States to face tax-related criminal charges.
Security personnel at the Brians 2 penitentiary near the north-eastern Spanish city tried to revive McAfee, who was 75, but the jail's medical team finally certified his death, a statement from the regional Catalan government said.
The statement did not identify the US tycoon by name, but said he was a 75-year-old US citizen awaiting extradition to the country.
Reporting by PA
A message from the Editor:Thank you for reading this article. We're more reliant on your support than ever as the shift in consumer habits brought about by Coronavirus impacts our advertisers.
If you haven't already, please consider supporting our trusted, fact-checked journalism by taking out a digital subscription.