If you don’t want any of the bells and whistle’s that come with Memory Clean, you can create your own application that cleans the memory with only a few lines of (easy) code.
Start by opening Terminal.
- Enter the following line:
cd
Desktop/
and press enter. This points the Terminal to your desktop rather than your user folder. You can point Terminal to any folder you want for this tutorial.
- Enter:
touch
Purge
and press enter. This creates a new file called “Purge” on your desktop, you won’t see it just yet though.
- Enter:
pico Purge
and press enter. This opens up the Terminal editor for the purge file.
- Enter the following text in the editor:
#!/bin/sh
purge
The
#!/bin/sh
command tells your computer that this is a terminal script, and thepurge
command tells the computer to purge or clean the memory. - Press Control + O and then Enter to save the file to your desktop. Then press Control + X to exit the editor. Make sure to use the Control key, not the command key.
- Once you’re back at the normal Terminal screen, enter:
chmod
755 Purge
and press enter. This makes the file we just created accessible to you. By default, OS X hides the files you create using
touch
. - You now will have a file on your desktop called “Purge.” You can open this file to automatically clean your computers memory. Once the Terminal shows a
[Process complete]
message you can close the application and continue on.
Thanks to tutsplus.com for this great tips.