Using Pg_dumpall to Move All Postgres Databases to a New Laptop

I recently upgraded laptops because it’s been 2 years and my business lease on it was up. Which: cool to have the new MacBook Air with the day-long-battery TM, but moving computers is a pain.

Except: I have dot files and that makes it easier. After copying my home directory over, re-dotfiling, things seemed good.

Except: my postgres databases. How to get them all from Air A to Air B without copying

Enter: pg_dumpall. It’ll dump every database into a file, with which you import on new computer.

When moving to a new computer

$ pg_dumpall > db.out

(Move file to to new computer)

$ psql -f dbout postgres

if you have trouble with “database $username not found”, type in “createdb”

To confirm,


And then \l to list the databases