[MacPorts] #49095: postgresql94 El Capitan initdb using default instructions fails without any failure message.

MacPorts noreply at macports.org
Mon Oct 5 14:10:23 PDT 2015


#49095: postgresql94 El Capitan initdb using default instructions fails without any
failure message.
---------------------------+-----------------------
  Reporter:  neilt@…       |      Owner:  mww@…
      Type:  defect        |     Status:  new
  Priority:  Normal        |  Milestone:
 Component:  ports         |    Version:  2.3.4
Resolution:                |   Keywords:  elcapitan
      Port:  postgresql94  |
---------------------------+-----------------------

Comment (by neilt@…):

 Replying to [comment:4 jwa@…]:
 > Also, what does the database directory contain: "sudo -u postgres ls -l
 /opt/local/var/db/postgresql94/defaultdb/"? Did you start the database
 server?

 It is my understanding that I have to init the database before starting
 the server.

 But in answer to your question, I get no results when I do ’sudo su
 postgres’ anything.  Which is what the install script recommends.

 For example this works:
 {{{
    MBP:myPoliticsDatabase nt$ initdb --version
    initdb (PostgreSQL) 9.4.4
 }}}
 This, based on the install instructions does not:
 {{{
    MBP:myPoliticsDatabase nt$ sudo su postgres -c 'initdb --version'
    MBP:myPoliticsDatabase nt$
 }}}
 But I did notice the following does work:
 {{{
    MBP:myPoliticsDatabase nt$ sudo -u postgres initdb --version
    Password:
    initdb (PostgreSQL) 9.4.4
 }}}

 So I tried the following using your suggestion below:
 {{{
   MBP:myPoliticsDatabase nt$ sudo -u postgres
 /opt/local/lib/postgresql94/bin/initdb -D
 /opt/local/var/db/postgresql94/defaultdb
 }}}

 And that worked fine.

 So the issue is that ’sudo su postgres’ as recommended in the install text
 does not work and ‘sudo -u postgres’ does work.  See the last line of the
 install instructions below.

 For reference this is what the install script outputs to the terminal:

 {{{
 Configure PostgreSQL
 ###########################################################
 # A startup item has been generated that will aid in
 # starting postgresql94-server with launchd. It is disabled
 # by default. Execute the following command to start it,
 # and to cause it to launch at startup:
 #
 # sudo port load postgresql94-server
 # sudo port unload postgresql94-server
 ###########################################################
 --->  Installing postgresql94-server @9.4.4_0
 --->  Activating postgresql94-server @9.4.4_0

 To create a database instance, after install do
 sudo mkdir -p /opt/local/var/db/postgresql94/defaultdb
 sudo chown postgres:postgres /opt/local/var/db/postgresql94/defaultdb
 sudo su postgres -c '/opt/local/lib/postgresql94/bin/initdb -D
 /opt/local/var/db/postgresql94/defaultdb'
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/49095#comment:6>
MacPorts <https://www.macports.org/>
Ports system for OS X


More information about the macports-tickets mailing list