gpt4 book ai didi

macos - 如何为 mac os x 安装 postgresql

转载 作者:行者123 更新时间:2023-11-29 11:30:39 29 4
gpt4 key购买 nike

我用的是homebrew,写这个命令到terminal.app安装postgresql。

`brew install postgresql`
<pre>==> Installing postgresql dependency: ossp-uuid
==> Downloading ftp://ftp.ossp.org/pkg/lib/uuid/uuid-1.6.2.tar.gz

curl: (7) couldn't connect to host
Trying a mirror...
==> Downloading http://www.mirrorservice.org/sites/ftp.ossp.org/pkg/lib/uuid/uuid-1.6.2.tar.gz
######################################################################## 100.0%
==> ./configure --disable-debug --without-perl --without-php --without-pgsql --prefix=/usr/local/Cell
==> make
==> make install
/usr/local/Cellar/ossp-uuid/1.6.2: 12 files, 332K, built in 62 seconds
==> Installing postgresql
==> Downloading http://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/v9.1.1/postgresql-9.1.1.t
######################################################################## 100.0%
==> ./configure --disable-debug --prefix=/usr/local/Cellar/postgresql/9.1.1 --enable-thread-safety --
==> make install-world
==> Caveats
# Build Notes

If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
https://github.com/mxcl/homebrew/issues/issue/2510

To build plpython against a specific Python, set PYTHON prior to brewing:
PYTHON=/usr/local/bin/python brew install postgresql
See:
http://www.postgresql.org/docs/9.1/static/install-procedure.html

# Create/Upgrade a Database

If this is your first install, create a database with:
initdb /usr/local/var/postgres

To migrate existing data from a previous major version (pre-9.1) of PostgreSQL, see:
http://www.postgresql.org/docs/9.1/static/upgrading.html

# Start/Stop PostgreSQL

If this is your first install, automatically load on login with:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.1.1/org.postgresql.postgres.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist

If this is an upgrade and you already have the org.postgresql.postgres.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
cp /usr/local/Cellar/postgresql/9.1.1/org.postgresql.postgres.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist

Or start manually with:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

And stop with:
pg_ctl -D /usr/local/var/postgres stop -s -m fast

# Other

Some machines may require provisioning of shared memory:
http://www.postgresql.org/docs/current/static/kernel-resources.html#SYSVIPC

If you want to install the postgres gem, including ARCHFLAGS is recommended:
env ARCHFLAGS="-arch x86_64" gem install pg

To install gems without sudo, see the Homebrew wiki.
==> Summary
/usr/local/Cellar/postgresql/9.1.1: 2739 files, 37M, built in 7.1 minutes </pre>

这是我的第一次安装。所以,我写在下面。 '$initdb/usr/local/var/postgres'

但这是错误的。为什么??

-bash: initdb/usr/local/var/postgres: No such file or directory

next, I write below. It's also error.

`$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start`
<pre>sh: /usr/local/var/postgres/server.log: No such file or directory</pre>

我检查它是否完成下载。

`$ brew list`
<pre>
brew-gem node postgresql readline
libyaml ossp-uuid rails ruby
</pre>

我可以看到有 postgresql。

所以,我不知道如何安装 postgresql。我是个初学者。

最佳答案

在initdb后面加一个空格:

$ initdb /usr/local/var/postgres

关于macos - 如何为 mac os x 安装 postgresql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8278814/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com