How do we change a setting in Firefox prefs.js?

Valued Contributor

This morning I read about a problem with Firefox not loading webpages.

The fix is simple, but I was hoping to be able to script the settings change. The problem I run into is that the path to the file is something like: /Users/username/Library/Application Support/Firefox/Profiles/8r5zj5rx.default-release/prefs.js

I don't know what characters will be before ".default-release", so that makes scripting this harder. I'm exploring some ideas like having the script first run the "ls -l" command to list the contents of the Profiles folder, but I'm getting stuck on how to get around the random characters and get into the folder. Is there a way to do this using a wildcard of some kind? Once I'm past this folder, it should be simple to write a "false" value for the setting that needs to be changed if a user is having a problem.


Contributor II

You can do a cat of the profiles.ini file in that same folder path to get the name of the default profile. That will ensure that you capture the profile that is loading and not just a list of all the profiles that have been created then trying to guess.




Thanks! Now I work on this and try to figure out how to take the results from cat and extract only what I need to proceed. I did something like this before so I'm looking at one of my past scripts to figure out how to modify the commands to use in this case.

New Contributor

Did you try:

#! /bin/sh

echo 'user_pref("network.http.http3.enabled", false);' >> `ls ~/Library/Application\ Support/Firefox/Profiles/*.default-release/prefs.js`