Restarting Firefox from the command line is useful when the browser is frozen, when you need to apply an update, or when you want to start with a clean slate without losing your open tabs. This guide shows you how to do it on Windows, macOS, and Linux using simple terminal commands. You don’t need any special tools—just a terminal or command prompt and the ability to type a few commands.
What You’ll Need
- A terminal or command prompt (Terminal on macOS/Linux, Command Prompt or PowerShell on Windows).
- Firefox installed on your system.
- Basic familiarity with running commands in your terminal.
Step-by-Step
Step 1: Close Firefox (if it’s running)
Before restarting from the command line, it’s usually best to close Firefox completely. You can do this by clicking the X on the window, or by using the command line to kill the process. On Windows, you can use taskkill /IM firefox.exe /F. On macOS, use pkill -x firefox. On Linux, use pkill firefox. This ensures a clean start.
Step 2: Open your terminal
- Windows: Press
Win + R, typecmd, and press Enter. Or right-click the Start button and select “Windows PowerShell” or “Command Prompt”. - macOS: Open Finder, go to Applications > Utilities, and double-click “Terminal”. Or use Spotlight (
Cmd + Space) and type “Terminal”. - Linux: Most distributions have a terminal shortcut, often
Ctrl + Alt + T. You can also find it in your applications menu.
Step 3: Run the restart command
The exact command depends on your operating system. In all cases, you can add the -restore flag to reopen your previous session (tabs and windows).
Windows
If Firefox is installed in the default location, you can use:
start firefox -restore
If that doesn’t work, you may need to specify the full path. For example:
start "" "C:\Program Files\Mozilla Firefox\firefox.exe" -restore
If you’re using the 64-bit version on 64-bit Windows, the path might be C:\Program Files\Mozilla Firefox\firefox.exe. On 32-bit systems, it’s usually C:\Program Files (x86)\Mozilla Firefox\firefox.exe.
macOS
Firefox is typically installed in the Applications folder. Use:
open -a Firefox -restore
If you have a specific version or location, you can use the full path:
open /Applications/Firefox.app -restore
Linux
Most Linux distributions have Firefox in the PATH, so you can simply run:
firefox -restore
If that doesn’t work, try the full path (common locations include /usr/bin/firefox or /opt/firefox/firefox):
/usr/bin/firefox -restore
Step 4: Wait for Firefox to open
After running the command, Firefox should launch. If you used the -restore flag, it will attempt to restore your previous session. If you didn’t, it will start with a new window (or your homepage).
Common Mistakes
- Not closing Firefox first: If Firefox is already running, the command may just open a new window in the existing process, which might not restart the browser. Always close it first.
- Wrong path: On Windows, using the wrong path will result in an error. Double-check the installation folder.
- Using the wrong command for your OS:
startis Windows-only,openis macOS-only, and on Linux you typically just type the executable name. - Forgetting the
-restoreflag: If you want to keep your tabs, you must include it. Without it, Firefox starts fresh. - Typing the command with a space in the path: On Windows, if you use
startwith a path containing spaces, you need to put the path in quotes, as shown above.
Tips
- Use
-privateto start Firefox in Private Browsing mode directly from the command line. - Use
-safe-modeto start Firefox with all add-ons disabled, which helps troubleshoot issues. - You can combine flags, like
firefox -restore -private(though the private window won’t restore the session). - On Linux, you can create an alias in your shell configuration file to shorten the command, e.g.,
alias ff='firefox -restore'. - If you’re automating a script, you can check if Firefox is running with
pgrep firefox(Linux/macOS) ortasklist | findstr firefox(Windows) before killing it.
Troubleshooting
Firefox doesn’t start at all: Check that the command executed without errors. If you get a “command not found” error, the Firefox executable is not in your PATH. Use the full path to the executable. On Windows, if the path is correct but nothing happens, try running the command from the directory where firefox.exe is located.
Firefox starts but doesn’t restore the session: The -restore flag only works if Firefox is configured to restore the previous session. Go to Firefox Settings > General > Startup and ensure “Open previous windows and tabs” is selected. Also, if Firefox crashed, it may show a “Restore Session” button instead of automatically restoring.
Firefox opens but is still frozen: If Firefox was unresponsive, the process might not have been fully terminated. Force quit it again using the kill command, wait a few seconds, and then start it again.
Permission denied on Linux: If you get a “Permission denied” error, the executable might not have execute permissions. You can try running it with sudo (not recommended for normal use) or check the file permissions with ls -l /usr/bin/firefox.
On macOS, “open” can’t find the app: If you get “The application cannot be found,” use the full path to the .app bundle, or use open -a "Firefox" (without the .app extension).
Windows: “start” command opens a new window but no Firefox: This can happen if the path is wrong. Try using the full path with quotes as shown in Step 3. Also, ensure you’re using the correct syntax: start "" "path"—the empty quotes are required if the path has spaces.
Frequently Asked Questions
Can I restart Firefox without closing my tabs?
Yes, use the -restore flag when starting Firefox. It will try to reopen the tabs and windows from your last session, provided Firefox is set to restore the previous session in its settings.
What does the -safe-mode flag do?
It starts Firefox with all add-ons disabled and resets some settings temporarily. This is helpful for diagnosing problems caused by extensions or custom settings.
Is there a command to restart Firefox with a specific profile?
Yes, use the -P flag followed by the profile name, like firefox -P myprofile. This opens the Profile Manager if you don’t specify a name.
Why does Firefox not restore my session even with -restore?
Check Firefox’s startup settings under Settings > General > Startup. If it’s set to “Show your home page,” the -restore flag won’t work. Also, if Firefox didn’t close cleanly, it may show a restore prompt instead.
Can I use these commands in a script to restart Firefox automatically?
Yes, you can create a script that kills Firefox, waits, and then starts it again with the desired flags. For example, a bash script on Linux might look like: pkill firefox; sleep 2; firefox -restore &.
What if I want to open a specific website after restarting?
Just add the URL at the end of the command, like firefox -restore example.com. This will open that site in a new tab (or in the restored session).
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Access Your Computer From Anywhere: Step-by-Step
- How to Get More Disk Space on Mac: 12 Fixes
- Wii Browser Games With a USB or Bluetooth Controller
- Delete Focus on iPhone: Quick Steps
- MacBook vs MacBook Air: Key Differences
- Fix Wrong Location on iPhone: 7 Steps That Work