Devo fazer uma nova instalação do PostGreSql?

3

Eu tive que reinstalar um aplicativo Rails em uma nova instalação do OSX Snow Leopard.

Eu tive uma sessão de puxar cabelo apenas tentando fazer com que o pg gem fosse instalado corretamente com o Rails. Primeiro instalei o PgSql 9 por meio deste link . No entanto, comecei a receber erros ao tentar executar a instalação do pacote:

Installing pg (0.10.0) with native extensions /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:529:in 'rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

        /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/bin/ruby extconf.rb 
checking for pg_config... yes
Ruby cflags: " -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long  -fno-common -pipe"
MacOS X build: fixing architecture flags:
  finding flags common to both Ruby and PostgreSQL...

*** Your PostgreSQL installation doesn't seem to have an architecture in common with the running ruby interpreter (["ppc", "i386", "x86_64"] vs. [])
I'll continue anyway, but if it fails, try setting ARCHFLAGS.
  testing for architecture: "ppc"
  testing for architecture: "i386"
  testing for architecture: "x86_64"
checking for libpq-fe.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/Chris/.rvm/rubies/ruby-1.9.2-p136/bin/ruby
    --with-pg
    --without-pg
    --with-pg-config
    --without-pg-config
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/lib
/Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/mkmf.rb:368:in 'try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/mkmf.rb:452:in 'try_cpp'
    from /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/mkmf.rb:853:in 'block in find_header'
    from /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/mkmf.rb:693:in 'block in checking_for'
    from /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/mkmf.rb:280:in 'block (2 levels) in postpone'
    from /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/mkmf.rb:254:in 'open'
    from /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/mkmf.rb:280:in 'block in postpone'
    from /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/mkmf.rb:254:in 'open'
    from /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/mkmf.rb:276:in 'postpone'
    from /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/mkmf.rb:692:in 'checking_for'
    from /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/mkmf.rb:852:in 'find_header'
    from extconf.rb:123:in '<main>'


Gem files will remain installed in /Users/Chris/.rvm/gems/ruby-1.9.2-p136/gems/pg-0.10.0 for inspection.
Results logged to /Users/Chris/.rvm/gems/ruby-1.9.2-p136/gems/pg-0.10.0/ext/gem_make.out
    from /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:507:in 'block in build_extensions'
    from /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:482:in 'each'
    from /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:482:in 'build_extensions'
    from /Users/Chris/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:156:in 'install'
    from /Users/Chris/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/source.rb:96:in 'install'
    from /Users/Chris/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/installer.rb:55:in 'block in run'
    from /Users/Chris/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in 'block in each'
    from /Users/Chris/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in 'each'
    from /Users/Chris/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in 'each'
    from /Users/Chris/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in 'run'
    from /Users/Chris/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in 'install'
    from /Users/Chris/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in 'install'
    from /Users/Chris/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in 'run'
    from /Users/Chris/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in 'invoke_task'
    from /Users/Chris/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in 'dispatch'
    from /Users/Chris/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in 'start'
    from /Users/Chris/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.10/bin/bundle:13:in '<top (required)>'
    from /Users/Chris/.rvm/gems/ruby-1.9.2-p136/bin/bundle:19:in 'load'
    from /Users/Chris/.rvm/gems/ruby-1.9.2-p136/bin/bundle:19:in '<main>'

Eu encontrei este artigo , o que sugere que eu instale o PgSql 8.3 via Mac Ports. Então fiz isso e segui o restante das instruções do artigo. Eu consegui configurar o pacote e iniciar o servidor rails via rails s sem problemas.

A minha principal preocupação é que acredito ter 2 instalações do PgSql. Um é a versão 9 e a outra versão 8.3. Devo desinstalar a versão 9 por qualquer motivo? Ou a última instalação substitui?

Ou eu não deveria me preocupar com isso? Em segundo lugar, procurei em todos os lugares pela documentação adequada sobre como desinstalar a versão 9 em um Mac OSX, sem sucesso.

    
por Christian Fazzini 05.02.2011 / 00:14

1 resposta

1

Não sei como funciona no Mac, mas no Linux o instalador do EnterpriseDB deixa um script de desinstalação, possivelmente vinculado a alguma entrada do menu. Você deveria procurar por isso.

As duas instalações devem poder coexistir pacificamente. Mas se você não precisa da instalação, você deve considerar removê-la, como é óbvio.

Em geral, recomendo usar Macports para PostgreSQL e outros softwares.

    
por 06.02.2011 / 21:24