osm2pgsql weird errors (tables missing)

I’ve set up my PostgreSQL gis db correctly (fairly sure), and configured it for PostGIS, but I am getting these errors when executing a osm2pgql command (tried with multiple osm files) :

jrbaldwin-MacBook-Pro:~ jrbaldwin$ osm2pgsql -c -G -U jrbaldwin -d gis redhook.osm
osm2pgsql SVN version 0.70.5 (32bit id space)

Using projection SRS 900913 (Spherical Mercator)
Setting up table: planet_osm_point
NOTICE: table “planet_osm_point” does not exist, skipping
NOTICE: table “planet_osm_point_tmp” does not exist, skipping
Setting up table: planet_osm_line
NOTICE: table “planet_osm_line” does not exist, skipping
NOTICE: table “planet_osm_line_tmp” does not exist, skipping
Setting up table: planet_osm_polygon
NOTICE: table “planet_osm_polygon” does not exist, skipping
NOTICE: table “planet_osm_polygon_tmp” does not exist, skipping
Setting up table: planet_osm_roads
NOTICE: table “planet_osm_roads” does not exist, skipping
NOTICE: table “planet_osm_roads_tmp” does not exist, skipping
Mid: Ram, scale=100

Reading in file: redhook.osm
error while opening file redhook.osm

jrbaldwin-MacBook-Pro:~ jrbaldwin$ osm2pgsql -c -G -U jrbaldwin -d gis new-york.osm
osm2pgsql SVN version 0.70.5 (32bit id space)

Using projection SRS 900913 (Spherical Mercator)
Setting up table: planet_osm_point
NOTICE: table “planet_osm_point” does not exist, skipping
NOTICE: table “planet_osm_point_tmp” does not exist, skipping
Setting up table: planet_osm_line
NOTICE: table “planet_osm_line” does not exist, skipping
NOTICE: table “planet_osm_line_tmp” does not exist, skipping
Setting up table: planet_osm_polygon
NOTICE: table “planet_osm_polygon” does not exist, skipping
NOTICE: table “planet_osm_polygon_tmp” does not exist, skipping
Setting up table: planet_osm_roads
NOTICE: table “planet_osm_roads” does not exist, skipping
NOTICE: table “planet_osm_roads_tmp” does not exist, skipping
Mid: Ram, scale=100

Reading in file: new-york.osm
error while opening file new-york.osm

//------//

What am I missing?

Missing tables are not an error. Osm2pgsql tries to drop old tables first but because you are doing the import for the first time there is nothing to drop. Real problem is in opening the .osm file. Perhaps the path to the file is not correct.

yes. That “does not exist, skipping” output has confused me, and many other people I’m sure.

Raised a bug

That won’t solve his import problem though. I had the same issue, and moving the .osm file to /tmp/ fixed it. The behavior is familiar – a program requiring that the user has proper permissions in all directories in the file’s path, which is a pain if you’re sudo’ing in as a db user. Anyway it’s worth a try. HIH