pgloader does this (and much much more) in a single command:
https://github.com/dimitri/pgloader
pgloader \
mysql://user:password@mysql:3306/database \
postgresql://postgres:root@localhost:5432/postgres
This is a gem of a tool. Surprised nobody has mentioned it. Supports SQLite and MS-SQL too.