[Script] One-click Mac cleaner (free RAM + clear caches)

`A small Python script that helps free up RAM and clear some system caches. Useful if your Mac is starting to slow down or if you have too many apps open.`

`
import os

import psutil

import subprocess

def get_ram():

ram = psutil.virtual_memory()

print(f"RAM utilisée: {ram.percent}%")

def clear_ram():

print("Libération de la RAM...")

subprocess.run(["sudo", "purge"])

def clear_user_cache():

print("Nettoyage du cache utilisateur...")

os.system("rm -rf ~/Library/Caches/*")

print("🍏 Mac Quick Cleaner")

print("--------------------")

get_ram()

choice = input("Nettoyer RAM et cache ? (y/n): ")

if choice.lower() == "y":

clear_ram()

clear_user_cache()

print("Nettoyage terminé.")

else:

print("Annulé.")

`

script in comment

Posted Mar 8, 2026, 1:12 PM UTC

10
Loading comments…