We demonstrate by three-dimensional hydrodynamical simulations of energy deposition into the envelope of a red supergiant model the inflation of a Rayleigh–Taylor unstable envelope that forms a compact clumpy circumstellar material (CSM). Our simulations mimic vigorous core activity years to months before a core-collapse supernova (CCSN) explosion that deposits energy to the outer envelope. The fierce core nuclear activity in the pre-CCSN explosion phase might excite waves that propagate to the envelope. The wave energy is dissipated where envelope convection cannot carry the energy. We deposit this energy into a shell in the outer envelope with a power of Lwave = 2.6 × 106L or Lwave = 5.2 × 105L for 0.32 yr. The energy-deposition shell expands while its pressure is higher than its surroundings, but its density is lower. Therefore, this expansion is Rayleigh–Taylor unstable and develops instability fingers. Most of the inflated envelope does not reach the escape velocity in the year of simulation but forms a compact and clumpy CSM. The high density of the inflated envelope implies that if a companion is present in that zone, it will accrete mass at a very high rate and power a pre-explosion outburst.