The geochemistry of minerals in intermediate to deep sedimentary rocks (2–10 km depth) is not known sufficiently well to predict accurately the effect of human activities, such as carbon dioxide sequestration or fracking. To carry out real-time experiments, a high-pressure environmental chamber (HPEC) was constructed for in situ X-ray diffraction (XRD) studies to 1000 bars and to 200°C. In the HPEC, a liquid, e.g. a brine, plus sample in suspension, is pressurized by gas, e.g. CH4 or CO2, or liquid, e.g. supercritical CO2. The unique aspect of this chamber is that the sample + liquid (~2 mL) form a dynamic system, and particles can move freely in the liquid while being illuminated by the X-ray beam. Several HPECs were constructed of Ti alloy, stainless steel, or carbon-fiber polyether ketone to be resistant to corrosion under basic or acidic conditions. These HPECs are compatible with standard transmission-mode diffractometers with sealed-tube X-ray sources (Mo radiation is being used at the University of Illinois at Chicago – UIC) or with brilliant X-ray sources. In addition, to allow long-duration studies or, for example, to study the effect of micro-organisms on these mineral reactions, a large-bore (~25 mL) reaction vessel system was devised that could be examined regularly at appropriate P/T conditions or off-line. Calibration of the HPEC and XRD pattern processing is discussed and illustrated. The potential significance of these devices goes beyond understanding the deep sedimentary environment, because materials and reactions can be studied while using nearly any liquid as an immersion agent. As an example, experimental results are given for the d001 values of montmorillonite clay vs. temperatures to 150°C at P(CO2) = 500 bars in a NaCl-rich brine.