The OGR Simple Features Library is a C++ Open Source library (and commandline tools) providing read (and sometimes write) access to a variety of GIS databases and vector file formats. It is related to GDAL, which focuses on raster formats.
ogr2ogr is a utility that comes with the library that can read OSM data and write formats supported by OGR.
ogr2ogr -f "ESRI Shapefile" outputdir inputosm.osm
Or to deal with errors:
ogr2ogr --config OSM_USE_CUSTOM_INDEXING NO -skipfailures -f "ESRI Shapefile" output input.osm -overwrite
ogr2ogr -overwrite --config OSM_CONFIG_FILE my_osmconf.ini -skipfailures -f "ESRI Shapefile" charentilly charentilly.osm
Being a low-level lightweight C++ tool, ogr2ogr converting functions tends to get bundled into other tools, which wrap the functionality in different interfaces. Some of these pre-date the adding of OSM support, and so they used to provide the only interface from OSM data into these other formats (But OSM support has since been included in OGR itself)
- Osmium - has support for OGR geometries and can be used to build converters from OSM to various GIS databases and file formats.
- GeoConverter - is an online tool offering some of these conversions