gpt4 book ai didi

postgresql - zsh : command not found: pg_dump on mac OS Big Sur

转载 作者:行者123 更新时间:2023-12-02 01:51:45 24 4
gpt4 key购买 nike

我使用的是 OSX Big Sur - 11.4 (20F71),我真的需要从我的本地设置中导出一个简单的数据库。

pg_dump 对我不起作用。

我不断得到:

zsh: command not found: pg_dump

我让 psql 命令运行,因为我添加了一个别名

psql='/Applications/Postgres.app/Contents/Versions/13/bin/psql -p5432'

让 pg_dump 工作的任何提示?

最佳答案

多亏了这个link

来自@Adrian Klaver

https://koenwoortman.com/zsh-add-directory-to-path/

我能够更多地了解 $PATH

像这样组织我的 $PATH :

export PATH=$PATH:/usr/local/opt/curl/bin
export PATH=$PATH:/usr/local/mysql/bin
export PATH=$PATH:/usr/local/bin
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/13/bin

实际的解决方案是:

export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/13/bin

我现在可以运行 pg_dump 了:

➜  Sites pg_dump                                                                                                            
--
-- PostgreSQL database dump
--

-- Dumped from database version 13.1
-- Dumped by pg_dump version 13.1

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- PostgreSQL database dump complete
--

关于postgresql - zsh : command not found: pg_dump on mac OS Big Sur,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70189157/

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