Skip to content

Instantly share code, notes, and snippets.

@juliandescottes
Last active April 26, 2024 22:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliandescottes/b0d3d83154d9ea8a84db5d32aa35d2c1 to your computer and use it in GitHub Desktop.
Save juliandescottes/b0d3d83154d9ea8a84db5d32aa35d2c1 to your computer and use it in GitHub Desktop.

Debug a local Firefox using about:debugging

This is a quick documentation to explain how to setup Firefox on OSX in order to try the "Network Locations" remote debugging in about:debugging.

Start the Client Firefox

Let's assume we are using a "Firefox Nightly" located in the Applications folder.

1 - You can start it once "as usual" by double clicking on the icon. This will be the "Client" where you will open about:debugging.

2 - Open about:debugging on the Client Firefox. Select the "Setup" category and check that you see a text input in the Network Locations section

Start the Server Firefox

We will need the terminal for this, because we need to start Firefox with some extra command line arguments. This is where the guide is OS specific.

1 - Find the path to your Firefox binary.

If the binary is Firefox Nightly and is in the Applications folder, the path should be /Applications/Firefox\ Nightly.app. The easiest way to get the path is to drag and drop the application Firefox Nightly in a Terminal window, it will paste the path in the terminal.

For the rest of the steps, we will assume the path is /Applications/Firefox\ Nightly.app, replace it with yours if needed

2 - Start Firefox with the command line.

In the terminal run

cd /Applications/Firefox\ Nightly.app/Contents/MacOS

(so append /Contents/MacOS to the path from step one)

Then run

./firefox -P my-server-profile --start-debugger-server 6080

Note my-server-profile is just going to be the name of the Profile we will use for this Server Firefox, you can use any other string if you prefer. 6080 is the port on which Firefox will listen for connections. If for some reason this port is not available on your machine, use any other port!

3 - Create and setup the server profile

The first time you do this, Firefox should first start the "Profile" window. Click on "Create Profile..." and name your profile with the same name as in the previous step. Then click on "Start Nightly".

4 - Set the remote debugging preferences

If this is the first time you are using this profile we also need to turn on remote debugging preferences. Open DevTools, go to Settings, and check "Enable browser chrome and add-on debugging toolboxes" as well as "Enable remote debugging". Quit Firefox and run again ./firefox -P my-server-profile --start-debugger-server 6080 in the terminal

5 - Allow debugging from another machine

If the server and client are on different machines, you also need to set devtools.debugger.force-local to false in about:config.

Connect from Client Firefox to Server Firefox

1 - Add the network runtime.

In the Client Firefox go to about:debugging, select the Setup category, and in Network Locations, add a new host "localhost:6080" (or another port if you used a different one earlier)

2 - Connect to the runtime.

In the sidebar of about:debugging, you should see "localhost:6080" with a Connect button. Click on the button. The button should disappear. Click on the sidebar item again to open the Runtime Page for this runtime.

3 - You are now connected to your Server Firefox.

You can try opening tabs in your Server Firefox, they should appear in about:debugging in your Client Firefox.

@zoepage
Copy link

zoepage commented Apr 12, 2019

Enable network locations on the Client Firefox. Go to about:config and set the preferences:

devtools.debugger.force-local set to false

Find the path to your Firefox Nightly binary.

/Applications/Firefox\ Nightly.app/Contents/MacOS =>

cd /Applications/FirefoxNightly.app/Contents/MacOS or cd /Applications/Firefox.app/Contents/MacOS
./firefox -P my-server-profile --start-debugger-server 6080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment