Homebrew's var folder held 1 GB of databases and logs that brew uninstall leaves behind
/opt/homebrew/var is where Homebrew services keep data and logs. Measured at 1.03 GB: MySQL, MongoDB, logs and a 177 MB temp folder.
brew cleanup clears old downloads and old versions. It never touches var, because that is where the things you installed keep their data: a database installed with Homebrew writes its tables there, and its logs sit next to them.
| Folder | Size | What it is |
|---|---|---|
var/mysql | 314 MB | MySQL's data directory |
var/log | 231 MB | Logs from Homebrew services |
var/mongodb | 206 MB | MongoDB's data directory |
var/homebrew/tmp | 177 MB | Homebrew's own temporary files |
Why it outlives the software
brew uninstall mysql removes the MySQL program from the Cellar and deliberately leaves var/mysql, so that reinstalling does not destroy your databases. That is the right default, and it means a database you tried once keeps its data forever unless you remove it by hand.
Check yours
du -sh /opt/homebrew/var/* 2>/dev/null | sort -h
brew services list
# Is the software that owns a data folder still installed?
brew list | grep -iE 'mysql|mongo|postgres|redis'What is safe to remove
| What | Safe? | Note |
|---|---|---|
| Data folder for a database you uninstalled | Yes, if you do not need the data | This is the real win |
| Data folder for a database you use | No | It is your data. Dump it first if you want it smaller |
var/log files | Yes | Stop the service first with brew services stop |
var/homebrew/tmp | Yes | Temporary files from installs |
brew services stop mysql
rm /opt/homebrew/var/log/*.logThe same pattern, data outliving its program, applies to databases installed any other way, and is covered in database data directories. The rest of Homebrew is in the Homebrew cache and Homebrew packages.
Common questions
What is /opt/homebrew/var?
It is where software installed with Homebrew keeps data and logs, for example MySQL's database files and service logs.
Does brew uninstall delete database data?
No. brew uninstall removes the program and leaves its data in /opt/homebrew/var, so a reinstall does not lose your databases.
Does brew cleanup clear the var folder?
No. brew cleanup removes old downloads and old versions only. The var folder has to be cleared by hand.
Is it safe to delete Homebrew logs?
Yes. Stop the service with brew services stop first, then remove the log files in /opt/homebrew/var/log.