Step #152 in the Expanded Vanilla list
To enable head bobbing, add
head bobbing = true to the
[Camera] section of your
settings.cfg file (add the section if it isn't already there).
For a more noticeable effect, add these (also to the
head bobbing step = 120.0 head bobbing height = 6.0 head bobbing roll = 0.5
Adjust these values until the effect is to your liking, see the official documentation on head bobbing here.