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.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)

7 Responses to “Blazing Fast Firefox using OSX RamDisk”

  1. Hi! I can’t seem to get this to work on my system. I created the start.sh file and placed it inside the folder where it is supposed to run. But nothing is being copied.

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  2. U may have to modify a little the script.
    do you have macports installed?
    what does it say when you run?

    did make the script executable?
    $ chmod 755 start.sh

    I changed the script above a little.

    VN:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  3. Hi! could you please post the script using TAR instead of rsync ?
    I’m not a bash expert and wasn’t able to use rsync nor to install it

    Thank you very much in advance!

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  4. wouldn’t it make sense to use a “lighter” fs than HFS+ in this case?

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  5. i like hfs+ cause it has journaling and is native to OSX…
    I’m no way gonna use fat32. :)

    VN:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  6. As a beginner I’ve been attempting this with partial success with firefox 3.6.
    Is there anything that needs to be changed with the script for 3.6 and for 4?
    Cheers, BBB

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  7. Success! I’m already using an Esperance DV RAMdisk and used the latter part of the “start” script to move and symlink the profile folder as per your instructions. Beginners trying that will need to cd the path to the folder containing ‘Profiles’, finding that via ‘about:support’ in the address window in FF. Awesome, cheers!

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

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

Switch to our mobile site