Dealing with Small MacBook Pro Disks with Git deinit and Photo Library
OK, one maddening thing that happened is one of my MacBooks has a tiny, as in 256GB hard drive. This is just too small for most uses particularly if you have lots of iCloud Photos or big github repos. I have both, so what are some solutions?
Slim down the random files
Well, if you use Space Gremlin as an example, you get a nice graphical view of your dirve and at least for me, I discovered that my ~/Library had over 50GB in it. That is a huge amount of space on it and here were some culprits. And all told, this got rid of 70GB by removing some caches and some big applications:
- Mactex. This is the Tex program for compositing documents and it takes 4GB of disk plus Texlive takes another 7GB, so unless you really need to write research papers this is a good ting to go.
- Homebrew keeps nearly all it’s old downloads in ~/Caches/Homebrew/downloads and that is 9GB on this machine. which you can get rid of with
brew cleanup -sand this got rid of 3GB
- Google Chrome is 3GB and has a big cache. I also use Vivaldi and it duplicates the functions. Another one is Wireshark which I also rarefly use. The System Information application is really useful for seeing what is taking up space.
- XCode also has separate caches for every version of MacOS, iOS and iPadOS it has ever run, so if you’ve been using it alot go to ~/Library/Developer and each simulator takes up alot of space, so crank up XCode and remove those by starting XCode and going to Window/Simulators and removing all the old ones. The truth is thought that you really do not need all of Xcode, most of the time the commandline tools is all you need. So it is hard to eradicate Xcode as it is just everywhere but you can start by trashing /Applications/Xcode.app, ~/Library/Developer, ~/Library /Cache
- Docker has 8GB worth of containers, so you can run docker prune -a to get rid of all iamges and containers.
- Git submodules. Ok, if you are using Git LFS, you can end up with some very large submodules and remember Git copies all versions down, so we have one system that is doing lots of images and it takes over 15GB, so the command to use is
git submodule deinit <name of module>this does not remove it from the repo, just the copy on the local machine. Similarly there is a cached copy of all submodules you’ve ever had on your machine, so you need to go to .git/modules and look for the submodule and remove that. This is just a cache, so it is for performance, but in my case, it duplicated the whole thing so useful to get rid of.
- Raspberry Pi Imager. This is another strange case, but this imager caches all the images you have, so get rid of this in ~/Library/Cache/Rasperry Pi
- CAches of previously deleted applications, so when you delete an application in /Applications, this does not get rid of the corresponding cache in ~/Library/Cache, so deleting Google, Unifi, Microsoft saves quite a bit of space
- The same is true of the ~/Library/Applications Support directory where I found lots of old applications like Google again and Unifi.
Get a thunderbolt Hard Drive
Well, this is not something that is very portable, but if you have something like this then you can move some files like the Photo library there. At least for me, the Photo Library because it has a cached copy of all 50K of my photos ends up being 1TB. Now, this means you cannot use this stuff while traveling, but I normally only need this when I’m scanning photos, etc.
Get a USB C Flash Drive
If you really need stuff on the road like photos, you can now get a tiny USB C Drive that you can stick into the port for real storage while traveling. a 256GB drive while much slower than the boot SSD is very handy if you really do run out of space.