pg_restore, when run without a database name, outputs a text dump to stdout; you can send that elsewhere with -f or with I/O redirection.
pg_restore -f mydatabase.sql mydatabase.dump
Note that you must ensure there’s no PGDATABASE environment variable set, or it’ll try to connect to that database.