Postgres.app设置:获取`哪个psql`返回所需的路径 [英] Postgres.app setup: getting `which psql` to return desired path

查看:365
本文介绍了Postgres.app设置:获取`哪个psql`返回所需的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚安装了Postgres.app,现在 psql 不返回任何东西。我按照Postgres网站上列出的说明;这是我做的:



1)将我的旧版本的Postgres拖到垃圾箱。已清空垃圾桶。



2)下载了当前版本的Postgres.app。将其拖动到应用程序文件夹。



3)重新启动的终端。



其中psql 是类似: /Applications/Postgres.app/Contents/Versions/9.3/bin/psql



当我运行 brew install postgresql 后跟 code>,我得到 / usr / local / bin / psql



如果这很有用,这里是我的.bashrc:

  if [-f〜/ .bash_profile];然后
source〜/ .bash_profile
fi

PATH =/ Applications / Postgres.app / Contents / MacOS / bin:$ PATH
export DYLD_LIBRARY_PATH = /Applications/Postgres.app/Contents/MacOS/lib:$DYLD_LIBRARY_PATH

###由Heroku Toolbelt添加
export PATH =/ usr / local / heroku / bin:$ PATH

rvm get stable --auto-dotfiles

export PATH =$ PATH:$ HOME / .rvm / bin#将RVM添加到PATH以编写脚本

和我的.bash_profile:

  export PATH = / usr / local / bin:$ PATH 
export PATH = / usr / local / share / python:$ PATH

#Python
export WORKON_HOME = $ HOME / .virtualenvs
export VIRTUALENVWRAPPER_PYTHON = / usr / local / bin / python2.7
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS =' - no-site-packages'
export PIP_VIRTUALENV_BASE = $ WORKON_HOME
export PIP_RESPECT_VIRTUALENV = true
如果[[-r /usr/local/share/python/virtualenvwrapper.sh]];然后
source /usr/local/share/python/virtualenvwrapper.sh
else
echo警告:找不到virtualenvwrapper.sh
fi

export PS1 =\h:\w \u\ $

#for git
LESS = - qrX -P%lt
export LESS

#colorize shell output
export CLICOLOR = 1
export LSCOLORS = Hxfxcxdxbxegedabagacad

#========== ALIASES = ==========

alias u =cd ..
alias uu =cd ../ ..
alias uuu =cd ../../ ..
alias cd .. =cd ..
alias rm =rm -i
alias ll =ls -laFGh
alias ls =ls -FGh
alias new =ls -lat | head -15

#节点不需要设置DYLD_LIBRARY_PATH
alias node =DYLD_LIBRARY_PATH =''; node

#postgres stuff
PATH =/ Applications / Postgres.app / Contents / MacOS / bin:$ PATH
export DYLD_LIBRARY_PATH =/ /Postgres.app/Contents/MacOS/lib:$DYLD_LIBRARY_PATH

[[-s$ HOME / .rvm / scripts / rvm]]&&源$ HOME / .rvm / scripts / rvm#将RVM加载到shell会话*作为函数*

非常感谢!

解决方案

解决方案!对于后代,这对我有用:



1)添加行 export PATH = $ PATH:/Applications/Postgres.app/Contents/ Versions / 9.4 / bin 到.bash_profile。要进一步阅读,我在 Postgres.app命令行工具页找到了此解决方案。 / p>

2)运行 brew卸载postgresql 。这似乎不太理想,因为我几乎肯定会想要它以后,但在卸载之前,到brew安装的postgresql的路径是我当我运行其中psql 。 / p>

I just installed Postgres.app, and now which psql returns nothing. I followed the instructions listed on the Postgres site; here's what I did:

1) Dragged my old version of Postgres to the trash. Emptied trash.

2) Downloaded the current version of Postgres.app. Dragged it to Applications folder.

3) Restarted Terminal.

The output I'm looking for from which psql is something like: /Applications/Postgres.app/Contents/Versions/9.3/bin/psql

When I run brew install postgresql followed by which psql, I get /usr/local/bin/psql. Which is at least something, but it's not what I want.

In case it's useful, here's my .bashrc:

if [ -f ~/.bash_profile ]; then
    source ~/.bash_profile
fi

PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
export DYLD_LIBRARY_PATH="/Applications/Postgres.app/Contents/MacOS/lib:$DYLD_LIBRARY_PATH"

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

rvm get stable --auto-dotfiles

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

And my .bash_profile:

export PATH=/usr/local/bin:$PATH
export PATH=/usr/local/share/python:$PATH

# Python
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python2.7
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_RESPECT_VIRTUALENV=true
if [[ -r /usr/local/share/python/virtualenvwrapper.sh ]]; then
    source /usr/local/share/python/virtualenvwrapper.sh
else
    echo "WARNING: Can't find virtualenvwrapper.sh"
fi

export PS1="\h:\w \u\$ "

# for git
LESS="-qrX -P %lt"
export LESS

# colorize shell output
export CLICOLOR=1
export LSCOLORS=Hxfxcxdxbxegedabagacad

#========== ALIASES ===========

alias u="cd .."
alias uu="cd ../.."
alias uuu="cd ../../.."
alias cd..="cd .."
alias rm="rm -i"
alias ll="ls -laFGh"
alias ls="ls -FGh"
alias new="ls -lat | head -15"

# node needs to not have DYLD_LIBRARY_PATH set
alias node="DYLD_LIBRARY_PATH=''; node"

# postgres stuff
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
export DYLD_LIBRARY_PATH="/Applications/Postgres.app/Contents/MacOS/lib:$DYLD_LIBRARY_PATH"

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

Many thanks!

解决方案

A solution! For posterity, here's what worked for me:

1) add the line export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin to .bash_profile. For further reading, I found this solution on the Postgres.app Command Line Tools page.

2) run brew uninstall postgresql. This seems suboptimal, as I'll almost certainly want it later, but before uninstalling, the path to the brew-installed postgresql is all I got when I ran which psql.

这篇关于Postgres.app设置:获取`哪个psql`返回所需的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆