How to free up disk space on mac

To see the space

df -h
diskutil info / | grep "Free Space"

To make space on mac

  • docker
    docker system prune --all --force --volumes
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker volume rm $(docker volume ls |awk '{print $2}')
rm -rf ~/Library/Containers/com.docker.docker/Data/*
  • yarn cache
    yarn cache clean
  • simulator images
    xcrun simctl delete unavailable
  • delete homebrew cache
    brew cleanup
    rm -rf $(brew --cache)
  • ruby
    gem cleanup --dryrun
    gem cleanup
  • javascript
    find . -name "node_modules" -type d -mtime +120 | xargs rm -rf
    find . -name "node_modules" -type d | xargs rm -rf
Related Post