MDN wants to learn about developers like you:


xpcshell is an XPConnect-enabled JavaScript Shell. It is a console application that lets you run JavaScript code. Unlike the ordinary JS shell (js), xpcshell lets the scripts running in it access XPCOM functionality.


You need your own build of Mozilla to use xpcshell.

Running xpcshell

./ ./xpcshell

xpcshell is almost always in the same directory as

$ locate

Just pick one, cd over there, and xpcshell, if it's present. (However, it might not be there if you have a non-debug version of Firefox, Mozilla, Thunderbird, etc.)

$ cd /opt/mozilla
$ ./ ./xpcshell

Using the Latest Version of Javascript

At present, xpcshell doesn't use the latest version of JavaScript, so newer language features, such as the let statement introduced in JavaScript 1.7, are not available. To rectify this, run xpcshell with the -v 180 command-line option, which tells xpcshell to use JavaScript 1.8.


You can input JavaScript, straight to Mozilla.

js> 5+7
js> print("Hello, world!")
Hello, world!

See also

Document Tags and Contributors

 Last updated by: Sevenspade,