Showing posts with label delete. Show all posts
Showing posts with label delete. Show all posts

Saturday, April 21, 2012

How to clean OSX (remove temp files and speedup your mac)

Clear OSX Space


The following set of procedures free some unnecessary files from your OSX drive and free space, also it sometimes help to fix slowness problems, but please be very very careful with the "sudo rm -f" command it is very dangerous so make sure you type it correctly.

Run cron tasks now

sudo periodic daily weekly monthly
Delete logs from your home folder
cd ~/Library/Logs
sudo rm -rf ~/Library/Logs/*
Delete cache from your home folder
rm -rf ~/Library/Safari/Downloads.plist
cd ~/Library/Caches
sudo rm -rf ~/Library/Caches/*
Flush Directory Service resolver cache (DNS, etc)
dscacheutil -flushcache
Update application pre-binding
sudo update_prebinding -root / -force
Repair disk permissions on boot volume
sudo diskutil repairPermissions /
Clear the global cache database
cd /Library/Caches
sudo rm -rf /Library/Caches/*
Flush system cache entries
cd /System/Library/Caches
sudo rm -rf /System/Library/Caches/*
Flush LaunchServices Database (helps with multiple "Open With" entries)
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
Flush Apple Type Server (ATS) cache (resolves issues with corrupt fonts some times)
sudo rm -rf `lsof | grep com.apple.ATS/annex.aux \
| grep Finder | cut -c 66-139`
sudo rm -rf /private/var/folders/*/*/-Caches-/com.apple.ATS
Repair disk permissions on boot volume
sudo diskutil repairPermissions /
restart your OSX and enjoy a cleaner and more free space on your OSX

Shay.BC.

Sunday, April 13, 2008

Shift+Delete to Permanent delete (Without Trash)


Are you tired of doing "Empty Trash" immediately after delete?
did you ever wanted to look in the trash and remove directly a file or two? without empting the whole trash can?
this is one feature that Apple over-looked, but windows switchers miss.

well miss no more, i have written an AppleScript (PermDelete) that allows the deletion of a file or several files or folder/s immidiately without going through the Trash.

I used "Spark" which is a cool free utility that runs a demon that allows you to keep keyboard shortcuts and bind them to AppleScript, Applications, Documents etc. once you click that combination anywhere in leopard (or Tiger), the demon traps it, and execute the appropriate operation you tolled it to, in our case Shift+Delete (not backspace) to execute the PermDelete AppleScript.

How will it Work?
while in Finder you can select files and folders and press Shift+Delete (not backspace) and a dialog will appear asking are you sure you want to delete this? if you press "OK" then the selected files and folders are deleted forever without a possibility to undelete or going to the trash to find them, if you press "Cancel" the script aborts and the deletion is canceled.

another benefit you get from this is that you can goto the trash and remove single or multiple items from the Trash without the need to empty the whole trash, just by selecting and pressing Shift+Delete (not backspace).

What is Apple Script?
AppleScript is Mac plugin script language, it is the VB for mac, it allows interaction with every application there is, activate features of that Application, control parts of the OS, even after an application has launched it can be manipulated, given instructions just as if you used its API or a user pressed on the menus and buttons, i will cover AppleScript in the comming posts on Dev4Mac.

What Do i need for the Task?

  1. Download this Script (i wrote it, use it freely)
  2. Download Spark utility
How to Install?
Install Spark Utility (very straight forward, mount the DMG, copy to Utilities or Applications)
execute Spark
add the PermDelete script to the AppleScript HotKey Group like this:
from the Option drop down menu on the upper left corner choose "AppleScript".


next choose your keyboard shortcut (i used Shift+Delete)


write some meaningful name to this shortcut, and choose "File" tab and select the previously downloaded permDelete script


lastly press the start button on the bottom of the screen so the Spark Demon can start working


that's it, try it.
you should get this dialog any time you try to permanently delete a file


one thing to remember: if you want this feature to be available from now on, you need the Spark demon running at all time, make it load at startup (if you stated so in the first run, or you can add it to your startup items look howto here). also if you alter the script then you should restart the demon from the application so changes will take effect, just run it again and from the screen press stop and start on the bottom button.

Enjoy.

 
the menu is from: Milonic DHTML menus