Originally used is the official installation package, but the installation package will create postgre this user, in the login interface look a bit uncomfortable, search for half a day unexpectedly did not find how to compile the installation under OSX tutorial, and if the official document compiled installation method will certainly let you crash, In the source code installation are similar to the idea, according to previous experience in Linux has passed, note to install Commander Line developers just.
./configure
Make
sudo mkdir/u01
sudo mkdir-p/u01/pgdata
sudo chown-r gtlions:staff/u01/pgdata
Make install
VI. bash_profile
Export Pgdata=/u01/pgdata
Export Pg_home= /usr/local/pgsql
Export Pgdatabase=postgres
Export Path=/usr/local/bin: $PG _home/bin: $PATH
Export ld_library_path=$PG _home/lib: $LD _library_path
Export dyld_library_path=$PG _home/lib: $DYLD _library_path
Initdb /u01/pgdata -E UTF8
Pg_ctl - L $PGDATA /server.log Start
gtlions:~ gtlions$ Ps-ef | grep postgres
501 1624 1622 0 9:05 morning?? 0:00.00 Postgres:checkpointer Process
501 1625 1622 0 9:05 morning?? 0:00.02 Postgres:writer Process
501 1626 1622 0 9:05 morning?? 0:00.00 Postgres:wal Writer Process
501 1627 1622 0 9:05 morning?? 0:00.00 postgres:autovacuum Launcher Process
501 1628 1622 0 9:05 morning?? 0:00.00 postgres:stats Collector Process
501 1622 1 0 9:05 am ttys001 0:00.02/usr/local/pgsql/bin/postgres
501 1636 1613 0 9:06 am ttys001 0:00.00 grep postgres
gtlions:~ gtlions$ Psql-l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access Privileges
-----------+---------+----------+-------------+-------------+---------------------
Postgres | gtlions | UTF8 | Zh_cn. UTF-8 | Zh_cn. UTF-8 |
Template0 | gtlions | UTF8 | Zh_cn. UTF-8 | Zh_cn. UTF-8 | =c/gtlions +
| | | | | Gtlions=ctc/gtlions
template1 | gtlions | UTF8 | Zh_cn. UTF-8 | Zh_cn. UTF-8 | =c/gtlions +
| | | | | Gtlions=ctc/gtlions
(3 rows)
gtlions:~ gtlions$ psql-ac "select version ();"
Select version ();
Version
--------------------------------------------------------------------------------------------------------------- --------------------
PostgreSQL 9.3.5 on x86_64-apple-darwin14.0.0, compiled by Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5SVN), 64-bit
(1 row)
gtlions:~ gtlions$
-eof-
Build and install PostgreSQL under Mac OSX