MDN wants to learn about developers like you:

On the phone, the b2g application (which provides the Firefox OS APIs among other things) is started through the /system/bin/ script. You can customize this script to change the behavior of Firefox OS, and this article explains how.

Set environment variables

If you just want to set an environment variable for a single run of B2G, then you can do the following:

adb shell stop b2g
adb shell "export ENV_VAR=value && /system/bin/"

If you want to use the same environment variables all of the time, then you can edit, as described in the next section.


For debugging, you may want to set environment variables to get logging information or to otherwise affect how the b2g program runs. You can do this by editing the script. There aren't any tools included on the phone to edit the file in place, so you'll need to copy it to your computer first.

  1. Connect the phone to your computer, open a terminal window, and execute the following command to edit the script:
    adb pull /system/bin/
  2. Edit the script to make the changes you want. For example, suppose you'd like to see some logging output (which requires a debug build), then you might add something like:
    export NSPR_LOG_FILE=/data/local/tmp/mylog.txt
    export NSPR_LOG_MODULES=Layers:5
  3. Run the following commands to save your updated script to the phone and restart b2g:
    adb shell stop b2g
    adb remount
    adb push /system/bin
    adb shell chmod 0755 /system/bin/
    adb shell start b2g

Note: /data/local/tmp is the only place on the filesystem which is writable by content processes.

See also


Document Tags and Contributors

 Contributors to this page: chrisdavidmills, staktrace, Sheppy,
 Last updated by: chrisdavidmills,