Abstract The relationship between changes in the macroscopic dimensions of a solid and its environmental conditions such as temperature or pressure can be rationalized at the molecular level. The controllable conversion of such external stimuli to mechanical energy can be exploited to construct mechanical or electromechanical devices, which are sometimes required to operate in extreme environments. Here we describe predominantly unidirectional expansion and contraction of an acicular porous molecular crystal owing to gas uptake or release. Using complementary in situ structural and photomicrographic techniques, we have obtained molecular-level insights that correlate macroscopic linear expansion of the crystal by up to 10% with the application of gas-specific pressure. We also demonstrate that the expansion of the needle axis with pressure can be modelled using the well-known Langmuir–Freundlich equation, thereby providing a convenient means of relating pressure and guest-induced linear expansion within a bounded continuum.