Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Radomir Perišić
Radomir Perišić

Posted on • Edited on

     

How to clean your dev junk and free disk space

WARNING: All processes are irreversible!

Node.js

Delete all unused global node modules and Node.js executables installed withnvm

Runningnvm ls will show you all versions installed, you can usenvm uninstall v12.2.0 for example to uninstall a specific version, however this doesn't remove global npm packages that you installed for this version. It's better to go to~/.nvm/versions/node folder andrm -rf versions that you don't need.

A useful command to delete all versions that you aren't currently using:

cd ~/.nvm/versions/node;ls-A |grep-v`nvm current` | xargsrm-rf
Enter fullscreen modeExit fullscreen mode

Delete all node_modules folders from your projects

Commands taken fromthis article

Check size of node_modules in folder with your projects

# Mac / Linuxcddocuments find.-name"node_modules"-type d-prune | xargsdu-chs# Windowscddocuments FOR /d /r. %din(node_modules) DO @IF EXIST"%d"echo %d"# --- Example output ---255M ./someProject/node_modules482M ./anotherOne/node_modules 707M total
Enter fullscreen modeExit fullscreen mode
Delete all node_modules folders
# Mac / Linuxfind.-name"node_modules"-type d-prune-execrm-rf'{}' +# WindowsFOR /d /r. %din(node_modules) DO @IF EXIST"%d"rm-rf"%d"
Enter fullscreen modeExit fullscreen mode

Yarn and npm cache

yarn cache cleannpm cache clean--force
Enter fullscreen modeExit fullscreen mode

Xcode

Really nice tool for deleting old simulators, archives and other Xcode junk:https://apps.apple.com/us/app/devcleaner-for-xcode/id1388020431?mt=12

Homebrew

Homebrewperiodacaly performs cleanup but if you need some extra space now, you can run:

brew cleanup
Enter fullscreen modeExit fullscreen mode

Docker

Docker needs to be running for this to work.
Be aware that docker removes all images that currently aren't used, so if you want to keep something, start it and it won't be deleted. Checkdocs for more info.

docker system prune-a# add '--volumes' to delete all volumes as well
Enter fullscreen modeExit fullscreen mode

If you have some lang/tool/ide that requires cleanup leave a comment and I will add it.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Some comments may only be visible to logged-in visitors.Sign in to view all comments.

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp