Car insurance
 

Firefox does a lot of IO to the disk even thou you have lots of spare Ram, due to Sqlite, Bookmarks, History and Cache.

To make Firefox faster is to store the whole profile folder into a Ram Disk.
RamDisk in Linux are called TmpFS. You can also use shared memory folder /dev/shm if you have it in your fstab.

This post in the gentoo forums explains how to do it in Gentoo linux.

I made a similar script to make it work in OSX Leopard.

The Script have 2 parts, Start.sh and Stop.sh
Here are the Scripts:

Start.sh

#!/bin/bash
# Run this script to enable the Ramdisk for Firefox profiles
VolumeName="Mozilla"
 
# Size in MB, make sure is not too low or not too high
SizeInMB=220
 
NumSectors=$((2*1024*SizeInMB))
 
DeviceName=`hdid -nomount ram://$NumSectors`
 
echo $DeviceName
 
diskutil eraseVolume HFS+ RAMDisk $DeviceName
 
# move the current profiles folder
mv Profiles Profiles_ &&
 
# make a symlink to the ramdisk
ln -s /Volumes/RAMDisk ./Profiles &&
 
# then copy it to the ramdisk
/bin/cp -r Profiles_/* Profiles

Stop.sh

#!/bin/bash
cd ~/Library/Cache/Firefox/
 
# clean the cache
rm -rf  Profiles/*/Cache/* &&
 
# will save your modifications back to the DISK
/usr/bin/rsync -av --delete ./Profiles/ ./Profiles_/ &&
 
# sometimes during unmount it will say disk is in use.
# make sure you close firefox before.
umount /Volumes/RAMDisk &&
rm -rf Profiles &&
mv Profiles_ Profiles

You can also use ‘tar’ instead of ‘rsync’. I just love rsync more.

* Warning: The ramdisk contents will be erased after you umount the ramdisk.

Have fun.

Gentoo Linux ROCKS

Update:

To speed up firefox even more  run these commands:

cd ~/Library/Caches/Firefox/Profiles
 
for i in */*.sqlite; do sqlite3 $i VACUUM;done;
 
cd ~/Library/Application\ Support/Firefox/Profiles
 
for i in */*.sqlite; do sqlite3 $i VACUUM;done;
VN:F [1.9.15_1155]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.15_1155]
Rating: 0 (from 0 votes)

 

The OSX file vault feature will only let you activate it on your current home folder if you have a HFS+ case-insensitive file system. It will not let you activate it on a current HFS case-sensitive.

But there is a trick, when creating a “new” clean user it will allow you to enable filevault for that new user.

So, here is how you do it.

But before you try, make sure you have enough free space, try to get rid of huge files and folders, backup your data. (in this case, we will copy your data, so you will have 2 copies for safety)

Also clean your applications cache, such as firefox cache, camino, opera,
~/Library/caches/com.apple.Safari/Webpage\ Previews/ , etc…: and close most of your applications.

$ cd ~/Library/Caches

$ find ./ -name “Cache” -exec rm -rf {} \;

$ rm -rf ~/Library/Caches/com.apple.Safari/Webpage\ Previews/Incoming/*

Steps

1. Create another admin user, for example “admin”, with administrator privileges

2. login as that user.

3. move your old user folder.

$ cd /Users/

$ sudo mv myusername myusername.bak

3. delete your old user from the “Accounts” preferences pane.

4. then create it again and check the option to use filevault

5. Logout from “admin” and login again as newuser.

6. Now copy the old data to your home folder. ( will take a very long time for that)
update: You must use rsync instead of cp, so that you also copy your VERY important hidden files. such as .ssh .gnupg .vimrc .gem .gitconfig etc..

$ sudo /usr/bin/rsync -av /Users/myusername.bak/ /Users/myusername/

# watch out if you have files that should not change the ownership, such as server backups.
$ sudo chown -R myusername ~/

7. Logout and login again, for your preferences to take effect

8. If everything looks fine, you might just delete the backup folder.

$ sudo rm -rf /Users/myusername.bak

if you have any confusions let me know in comments.

VN:F [1.9.15_1155]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.15_1155]
Rating: 0 (from 0 votes)

 

First of all, what do I mean by safe sleep, fast sleep or hibernate?

Safe sleep is the way OSX sleeps to RAM and as well create a sleepimage (which is the size of your RAM). In case you run out of battery, so you can still resume from the image if the battery is dead, (and you have plugged it in :)  Provides very fast wake up, uses the battery while sleeping.

Fast Sleep is just sleep to RAM, same as safe sleep but no image creation, and if your battery is dead, the mac will cold boot. Provides very fast wake up same as safe sleep, uses the battery while sleeping.

Hibernate is when it uses the sleepimage all the time. Slower sleep and slow wake up, but it does not use battery at all…

So…

I found in this website http://alt.cc/jk/2007/08/07/safe-sleep-addendum/ this nice script that handles when to FastSleep or when to Hibernate.

you can get safe sleep with the command “$ sudo pmset hibernate 3″

I have modified the script it little :

#!/bin/sh
MODE=`/usr/bin/pmset -g | grep hibernatemode | awk '{ print $2 }'`
LEFT=`/usr/bin/pmset -g batt | grep Internal | awk '{ print $2 }' | awk -F % '{ print $1 }'`
HIBERNATE=20
FASTSLEEP=50
echo "Running safesleep.sh => MODE: ${MODE} LEFT: ${LEFT}" >> /var/log/system.log
if [ $LEFT -lt $HIBERNATE ] && [ $MODE != 3 ] ; then
	{
		echo "Less than ${HIBERNATE}% remains" >> /var/log/system.log
		echo "Setting Hibernate (hibernate mode 1)" >> /var/log/system.log
		`/usr/bin/pmset -a hibernatemode 1`
		LS=`ls -al /private/var/vm/sleepimage`
		echo "The sleepimage should be created:" >> /var/log/system.log
		echo "${LS}" >> /var/log/system.log
	}
elif  [ $LEFT -gt $FASTSLEEP ] && [ $MODE != 0 ]; then
	{
		echo "Greater than ${FASTSLEEP}% remains" >> /var/log/system.log
		echo "Setting FastSleep (hibernate mode 0)" >> /var/log/system.log
		`/usr/bin/pmset -a hibernatemode 0`
		`rm -rf /var/vm/sleepimage`
	}
fi

save it as /Users/your_user_name/.crons/safesleep.sh

now make it permanent in a crontab to run every 10 minutes, but wait, anacron (osx default cron) only supports daily/weekly/monthly jobs! (unless you patch it)

I guess we’ll have to install fcron:

$ sudo port -d install fcron

$ sudo vi /opt/local/etc/fcrontab


@,runas(root) 10 sh /Users/your_user_name/.crons/safesleep.sh

$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.fcron.plist

$ sudo launchctl start org.macports.fcron

that’s it.

enjoy

VN:F [1.9.15_1155]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.15_1155]
Rating: +1 (from 1 vote)

© 2012 Ruby, Rails, OSX and Linux fun Suffusion theme by Sayontan Sinha

Switch to our mobile site