osm2pgsql Error: operator class "gist_geometry_ops" does not exist for access method "gist"

There’s a thorough explanation in the PostGIS FAQ:

In PostGIS 2, the default geometry operator class gist_geometry_ops was changed to gist_geometry_ops_2d and the gist_geometry_ops was completely removed.

Simply remove the gist_geometry_ops statement, changing this:

CREATE INDEX idx_my_table_geom ON my_table USING gist(geom gist_geometry_ops);

To this:

CREATE INDEX idx_my_table_geom ON my_table USING gist(geom);