BonFX

Typography & Graphic Design Blog

  • Facebook
  • RSS
  • Twitter
  • Blog
  • Books
    • The Preposterously Huge Book of Google Font Combinations
    • The Big Book of Font Combinations (Classic Fonts Edition)
  • About
  • Gallery
    • Monster Alphabet
    • Pen and Ink Cartoons
    • The Algorithm FX
  • Contact
You are here: Home / Made Me Laugh / How to fix the Firefox memory leak on Mac OS and Windows, once and for all, like a boss

How to fix the Firefox memory leak on Mac OS and Windows, once and for all, like a boss

July 1, 2011 by Douglas Bonneville

Some of you will love this, and some of you are going to flame me. I don’t care about the haters though. Even though a fellow TYPO3 developer friend pointed out regarding my solution, “There has to be a better way. There probably is”, I’m posting this as a help to all the Firefox users of the world who are sick to death of the phantom Firefox memory leaks. We all know Firefox leaks memory for one reason or another. It’s been years. Plugins have come and gone and Firefox just leaks all the time. Period. What to do? It’s time to hit Firefox with a sledgehammer. Like a boss. This requires just the slightest bit of Mac OS savvy, but not much, or else I couldn’t have done it. Windows is a bit easier, but I’ll post the Mac version first and follow up next week with the Windows solution. The solution is to simply kill and restart Firefox as quickly as possible. Boom. Done. Firefox goes from sappy to snappy in about 1 second. Firefox tries to restore you tabs when it “crashes” so you should be good. On the Mac, you might get the “restore” or “new session” buttons. On the PC, for me at least, it comes right back up without the question. This has been tested on Firefox 3.x, 4, and now 5 on both Mac and PC. Your mileage may vary. Make sure you aren’t composing an email in a webmail interface or anything before you test this! But wait! Am I really sure Firefox has a memory leak? I present my anecdotal evidence:

How to kill and restart Firefox on a Mac in 1 second

  • Create a text file, like “killFirefox.txt” somewhere on your Mac.
  • After saving it as a .txt file, change it to “killFirefox.command”
  • Paste this into it:
    • killall -c firefox-bin
      sleep 1
      open -a Firefox
      sleep 1
      exit
  • Now open Terminal and navigate to wherever you saved the file. You’ll have to Google how to use Terminal commands, or get an “open terminal here” plugin for Finder (like I have)
  • Once you are in the directory where “killFirefox.command” is, run the following command to make your .command file executable. This means that after you do this, you’ll be able to double-click “killFirefox.command” and the script will run:
    • chmod 755 killFirefox.command
  • Now go back to Finder or wherever you saved the file, and drag it to the RIGHT side of the “dashed line” on your dock if you want one-click access to the process:
  • Try it!
  • Happy Firefox rebooting! Goodbye slow and sappy Firefox—until a real solution is in place!
You may have to alter the “sleep 1” to something longer, like 2 or 3 seconds if your Mac is too slow. You may also have to put in a different path, but I’m no terminal expert. Also, to set the Terminal window to close after the process finishes, you’ll have to edit the preferences like this: Terminal > Preferences > Settings > When the shell exits = Close the window

How to kill and restart Firefox on a PC in 1 second

  • Create a file, like “killfirefox.txt” on your desktop or somewhere handy
  • Paste this into it:
    • taskkill /f /im firefox.exe
      start /wait "" "C:\Documents and Settings\[--Your User Account Here--]\Local Settings\Application Data\Mozilla Firefox\firefox.exe"
  • You’ll want to make sure you put in your user account name in the path, and delete the “Your User…” holder text
  • Your path to firefox.exe, as listed above, might also be in a different place. You’ll have to find it and confirm.
  • Rename the file extension from “.txt” to “.bat”
  • Double click your new .bat file and voila!
  • Make a shortcut and drag to your quick links bar, or some other handy place

So you have a better way to do this?

Save your negative comments for the comments section on msnbc.com. In the meantime, post instructions on a better way. For example, how to do this in AppleScript so you end up with a real “app” you can put in the Dock in a nice way. Any other thoughts? Let’s here them!

Filed Under: Made Me Laugh

About Douglas Bonneville

Douglas has been a graphic designer since 1992, in addition to software developer and author. He is a member of Smashing Magazine's "Panel of Experts" and has contributed to over 100 articles. He is the author of "The Big Book of Font Combinations", loves cats, and plays guitar.

Comments

  1. Jon Levi says

    July 12, 2011 at 12:09 pm

    This is unnecessary. If you’re looking for a QUICK way to restart Firefox, there are at least two addons to do just that.

    This one adds a restart button: https://addons.mozilla.org/en-US/firefox/addon/restart-button/

    This one adds a restart button and a keyboard shortcut: https://addons.mozilla.org/en-US/firefox/addon/restartless-restart/

    Glad I could help.

  2. Douglas Bonneville says

    July 12, 2011 at 1:22 pm

    Thanks Jon – I’m trying the first one now. We’ll see how well it stays updated with the FF releases! Short of developing an add-on, at least my method is “version and platform independent” 🙂 We’ll also have to see how well it works when FF gets really bad after a few hours of use. I’ll post something back after I use it for a while!

  3. Benjamin says

    October 11, 2011 at 5:23 am

    Hi Douglas,

    I’m on a Mac and since the last Firefox update it doesn’t work anymore.

    The command prompt says :
    “No matching processes belonging to you were found”

    I’m using the version 7.0.1 of Firefox.

    Do you know what the new workaround for this is ?

    Thanks a lot,

    Cheers,

  4. Douglas Bonneville says

    October 13, 2011 at 3:51 am

    Hi Jon: I tried Restartless Restart 8 when I went to Firefox 7, and it’s one step easier. You can put the icon for it right in the toolbar. Give that a whirl and see how it goes. 7, on my Mac, does seem faster and better, but the memory leaks, no matter what Mozilla says, is the same as it ever was, thus, the need for a quick restart that keeps all your tabs remains. Bummer!

  5. Tom Hunter says

    June 24, 2013 at 1:05 am

    For the record:

    OS X 10.8.4

    Firefox 21.0 (21! This problem has gone unfixed for 17 releases!!!!)

    Firefox running ONE TAB. Memory usage for Firefox (as told by Mac Activity Monitor) creeps up to 3 GB before it hangs forever.

    How about you stop with the stupid releases for no good reason and fix this fundamental issue?

  6. Douglas Bonneville says

    June 24, 2013 at 1:11 am

    I know, right? My solution is to use the add-on Startless Restart. Every few hours my memory usage is just over or under a gig! Chrome looks better by the day except a few extensions I love aren’t ported for it yet.

  7. Scott says

    May 12, 2014 at 1:20 pm

    Firefox still leaks like crazy! LAME! I’m using FF 29.0.1 on OSX 10.6.8. I used to be a die hard FF fan. Not any more…. This browser kills me. Creating new FF profiles does not fix the problem. I’m super close to trashing this junk browser all together. Thanks for the write up Doug.

  8. Douglas Bonneville says

    May 12, 2014 at 1:22 pm

    I gave up, went Chrome, and haven’t looked back. Make the decision to junk it, and go to a better browser. I was a diehard FF fan for so long, but leaving it behind was really nice. No more having to restart X times a day! How archaic!

Lost in UX like I was?

"What do all these terms mean?"

But then a cat showed me the UX way with simple definitions and funny visual examples.

Now, I remember them all!


Check out "UX for Cats"


Font Combinations Book

On Sale Now at
Amazon

HOW TO MAKE INSPIRED FONT COMBINATIONS (without spending all day clicking things).


Font Combinations Book  

On Sale Now at
Amazon / Barnes & Noble

Or get the PDF eBook version, INSTANT ACCESS, 40% off Retail, now at the BonFX Store

Need Font Pair Ideas? How about 7500 pages of them?

Fantasticaly faster than fiddling with finicky font file formats


Font Combinations Book  

Get the PDF eBook INSTANT ACCESS, now at the BonFX Store

Recent Inspirations

  • 50 essential UX terms you need to know, illustrated with… July 18, 2024
  • “UX for Cats”, the perfect fun little book for UX beginners May 22, 2024
  • User Research in UX January 1, 2024
  • Rapid Prototyping October 23, 2023
  • Error Prevention in UX October 23, 2023
  • User Engagement in UX October 23, 2023
  • Empathy in UX October 23, 2023
  • Visual Hierarchy in UX October 23, 2023
  • Fidelity in UX October 23, 2023
  • Consistency in UX October 23, 2023
  • A/B testing in UX October 23, 2023
  • Key Performance Indicators in UX October 23, 2023
  • Task Analysis in UX October 23, 2023
  • User Stories in UX October 23, 2023
  • User Surveys in UX October 23, 2023

Copyright © 2025 · BonFX

  • Blog
  • Books
    • The Preposterously Huge Book of Google Font Combinations
    • The Big Book of Font Combinations (Classic Fonts Edition)
  • About
  • Gallery
    • Monster Alphabet
    • Pen and Ink Cartoons
    • The Algorithm FX
  • Contact