Skip to content

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.

5 min read

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.

FolderSizeWhat it is
var/mysql314 MBMySQL's data directory
var/log231 MBLogs from Homebrew services
var/mongodb206 MBMongoDB's data directory
var/homebrew/tmp177 MBHomebrew'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

WhatSafe?Note
Data folder for a database you uninstalledYes, if you do not need the dataThis is the real win
Data folder for a database you useNoIt is your data. Dump it first if you want it smaller
var/log filesYesStop the service first with brew services stop
var/homebrew/tmpYesTemporary files from installs
brew services stop mysql
rm /opt/homebrew/var/log/*.log

The 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.

Read next