Photoshop likes to pre-allocate all the RAM it will use, to prevent it from doing slow swapping to disk. Try quitting everything else. Try reducing your undo count.

One other option is of course to get more RAM. Apple charges an ARM and a leg for RAM, but some of their systems are user upgradable with non-Apple RAM. I bought my iMac with 8GB, then bought 16GB (2 x 8GB) more online.

If you choose this route. Click on the apple in the menu bar, About This Mac, then the click on memory tab. This will tell you the type of RAM you need, and what's already installed, whether there are free slots, etc. Mine says 1600Mhz DDR3, and shows I have 2 x 4GB, 2 x 8 GB. It even has a button for instruction on upgrading (takes you here: https://support.apple.com/en-us/HT201191 ). When I went to order my RAM I noticed there are different voltages available, which that site didn't talk about (atleast not for my model). Digging around online I found that the Mac doesn't care. It can use whatever voltage RAM you want.