<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Radomir Perišić</title>
    <description>The latest articles on DEV Community by Radomir Perišić (@radomirperisic).</description>
    <link>https://dev.to/radomirperisic</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F499462%2F20b315d3-bafd-471b-9047-faffcab948b1.png</url>
      <title>DEV Community: Radomir Perišić</title>
      <link>https://dev.to/radomirperisic</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/radomirperisic"/>
    <language>en</language>
    <item>
      <title>How to clean your dev junk and free disk space</title>
      <dc:creator>Radomir Perišić</dc:creator>
      <pubDate>Tue, 01 Feb 2022 17:33:19 +0000</pubDate>
      <link>https://dev.to/radomirperisic/how-to-clean-your-dev-junk-and-free-space-2a18</link>
      <guid>https://dev.to/radomirperisic/how-to-clean-your-dev-junk-and-free-space-2a18</guid>
      <description>&lt;h1&gt;
  
  
  WARNING: All processes are irreversible!
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Node.js
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Delete all unused global node modules and Node.js executables installed with &lt;a href="https://github.com/nvm-sh/nvm"&gt;nvm&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Running &lt;code&gt;nvm ls&lt;/code&gt; will show you all versions installed, you can use &lt;code&gt;nvm uninstall v12.2.0&lt;/code&gt; 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 &lt;code&gt;~/.nvm/versions/node&lt;/code&gt; folder and &lt;code&gt;rm -rf&lt;/code&gt; versions that you don't need.&lt;/p&gt;

&lt;p&gt;A useful command to delete all versions that you aren't currently using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/.nvm/versions/node&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-A&lt;/span&gt; | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;nvm current&lt;span class="sb"&gt;`&lt;/span&gt; | xargs &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Delete all node_modules folders from your projects
&lt;/h3&gt;

&lt;p&gt;Commands taken from &lt;a href="https://medium.com/@MarkPieszak/how-to-delete-all-node-modules-folders-on-your-machine-and-free-up-hd-space-f3954843aeda"&gt;this article&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Check size of node_modules in folder with your projects
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Mac / Linux&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;documents 
find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"node_modules"&lt;/span&gt; &lt;span class="nt"&gt;-type&lt;/span&gt; d &lt;span class="nt"&gt;-prune&lt;/span&gt; | xargs &lt;span class="nb"&gt;du&lt;/span&gt; &lt;span class="nt"&gt;-chs&lt;/span&gt;

&lt;span class="c"&gt;# Windows&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;documents 
FOR /d /r &lt;span class="nb"&gt;.&lt;/span&gt; %d &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;node_modules&lt;span class="o"&gt;)&lt;/span&gt; DO @IF EXIST &lt;span class="s2"&gt;"%d"&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; %d&lt;span class="s2"&gt;"

# --- Example output ---
255M ./someProject/node_modules
482M ./anotherOne/node_modules 
707M total
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Delete all node_modules folders
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Mac / Linux&lt;/span&gt;
find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"node_modules"&lt;/span&gt; &lt;span class="nt"&gt;-type&lt;/span&gt; d &lt;span class="nt"&gt;-prune&lt;/span&gt; &lt;span class="nt"&gt;-exec&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; &lt;span class="s1"&gt;'{}'&lt;/span&gt; +

&lt;span class="c"&gt;# Windows&lt;/span&gt;
FOR /d /r &lt;span class="nb"&gt;.&lt;/span&gt; %d &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;node_modules&lt;span class="o"&gt;)&lt;/span&gt; DO @IF EXIST &lt;span class="s2"&gt;"%d"&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; &lt;span class="s2"&gt;"%d"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yarn and npm cache&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn cache clean
npm cache clean &lt;span class="nt"&gt;--force&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Xcode
&lt;/h2&gt;

&lt;p&gt;Really nice tool for deleting old simulators, archives and other Xcode junk: &lt;a href="https://apps.apple.com/us/app/devcleaner-for-xcode/id1388020431?mt=12"&gt;https://apps.apple.com/us/app/devcleaner-for-xcode/id1388020431?mt=12&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Homebrew
&lt;/h2&gt;

&lt;p&gt;Homebrew &lt;a href="https://docs.brew.sh/FAQ#how-can-i-keep-old-versions-of-a-formula-when-upgrading"&gt;periodacaly performs cleanup&lt;/a&gt; but if you need some extra space now, you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew cleanup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Docker
&lt;/h2&gt;

&lt;p&gt;Docker needs to be running for this to work.&lt;br&gt;
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. Check &lt;a href="https://docs.docker.com/engine/reference/commandline/system_prune/"&gt;docs&lt;/a&gt; for more info.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker system prune &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;span class="c"&gt;# add '--volumes' to delete all volumes as well&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

</description>
      <category>management</category>
      <category>linux</category>
      <category>osx</category>
      <category>cleanup</category>
    </item>
  </channel>
</rss>
