You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在macOS中为postgresql@13创建PostGIS符号链接?

解决PostGIS与postgresql@13的链接问题

方案一:重新安装适配postgresql@13的PostGIS版本(推荐)

这是最稳妥的方法,确保PostGIS完全适配你的postgresql@13:

  • 停止所有PostgreSQL服务:
    brew services stop postgresql@13
    brew services stop postgresql@14
    
  • 卸载当前的PostGIS:
    brew uninstall postgis
    
  • 将postgresql@13设为brew默认的PostgreSQL版本:
    brew link postgresql@13 --force
    
  • 重新安装PostGIS,brew会自动编译适配postgresql@13的版本:
    brew install postgis
    
  • 启动postgresql@13服务:
    brew services start postgresql@13
    
  • 再次进入psql执行CREATE EXTENSION postgis;即可成功。

方案二:手动创建软链接(快速临时解决)

如果不想重新安装,可以手动将PostGIS的扩展文件链接到postgresql@13的目录:

  • 确认PostGIS扩展文件的位置(默认在postgresql@14的目录下),执行链接:
    mkdir -p /opt/homebrew/opt/postgresql@13/share/postgresql@13/extension/
    ln -s /opt/homebrew/opt/postgresql@14/share/postgresql@14/extension/postgis* /opt/homebrew/opt/postgresql@13/share/postgresql@13/extension/
    
  • 重启postgresql@13服务:
    brew services restart postgresql@13
    
  • 进入psql执行CREATE EXTENSION postgis;即可。

注意:手动链接可能存在版本兼容性隐患,若后续出现异常,建议切换到方案一重新安装。

内容的提问来源于stack exchange,提问作者0x55b1E06FF

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 11:42:45