Look at /usr/lib/libpq library. I have had the same problem. There were following files:
-rwxr-xr-x 1 root wheel 163680 30 jul 21:17 /usr/lib/libpq.5.4.dylib
lrwxr-xr-x 1 root wheel 15 30 jul 21:20 /usr/lib/libpq.dylib -> libpq.5.4.dylib
Result for command sudo /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/wipeDB .sh was:
Password:
devicemgr:state = "STOPPED"
postgres:state = "RUNNING"
(in /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend)
Couldn't drop device_management : #<RuntimeError: Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (dlopen(/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backen d/vendor/gems/pg-0.9.0/lib/pg_ext.bundle, 9): Library not loaded: /usr/lib/libpq.5.dylib
Referenced from: /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor /gems/pg-0.9.0/lib/pg_ext.bundle
Reason: image not found - /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor /gems/pg-0.9.0/lib/pg_ext.bundle)>
(in /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend)
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (dlopen(/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backen d/vendor/gems/pg-0.9.0/lib/pg_ext.bundle, 9): Library not loaded: /usr/lib/libpq.5.dylib
Referenced from: /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor /gems/pg-0.9.0/lib/pg_ext.bundle
Reason: image not found - /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor /gems/pg-0.9.0/lib/pg_ext.bundle)
/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/abstract/connection_spe cification.rb:76:in `establish_connection'
/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/railties/lib/tasks/databases.rake:69:in `create_database'
/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/railties/lib/tasks/databases.rake:31
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 636:in `call'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 636:in `execute'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 631:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 631:in `execute'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor. rb:242:in `synchronize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 590:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 583:in `invoke'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2051:in `invoke_task'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2029:in `top_level'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2029:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2029:in `top_level'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2068:in `standard_exception_handling'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2023:in `top_level'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2001:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2068:in `standard_exception_handling'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 1998:in `run'
/usr/bin/rake:31
Couldn't create database for {"adapter"=>"postgresql", "username"=>"_devicemgr", "encoding"=>"UTF8", "pool"=>5, "database"=>"device_management"}
devicemgr:state = "STARTING"
There was missing symlink to right version of libpq dynamic library!
After I entered the following commands and now it works well for me:
$ cd /usr/lib
$ sudo ln -s libpq.5.4.dylib libpq.5.dylib
$ sudo /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/wipeDB .sh
devicemgr:state = "STOPPED"
postgres:state = "RUNNING"
(in /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend)
(in /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend)
devicemgr:state = "RUNNING"
Milan