I need to import a SQL Server database which is in the
.mdf format into a PostgreSQL database. My system is Mac OS X.
How to do it in the easiest way?
You'll need to attach the database to a Microsoft SQL Server database, the export the data into the Postgres database. Assuming that you've got the Windows Postgres ODBC drivers handy you can use SQL Server's Import/Export wizard to copy the data into the Postgres database.
I've had to do the opposite of this by which I used this process: http://dba.stackexchange.com/a/15833/4490
So you could reverse the insert ...
Link the postgres server
This would require that you have already set up the database schema on the postgres server.
Later, in other answers, the user discovered Kettle with which you can build an ETL process to connect from MSSQL to postgres. I've never had success with the Import/Export wizard in SSMS, but if you can get that to work then that'd definitely be the lowest LOE.
Another option might be to install the
As @AaronBertrand noted, it is unclear as to whether or not you have a SQL Server instance available to you, or if it is just a data file that you have in your possession.