mirror of
https://github.com/meineerde/dotfiles.git
synced 2026-02-23 12:01:44 +00:00
Find correct python bin path with multiple pythons installed by Homebrew
This commit is contained in:
parent
045bddd3a4
commit
7bb8ad691b
23
.bashrc
23
.bashrc
@ -88,10 +88,27 @@ case `uname` in
|
|||||||
fi
|
fi
|
||||||
function fullscreen() { printf "\e[3;0;0;t\e[8;0;0t"; return 0; }
|
function fullscreen() { printf "\e[3;0;0;t\e[8;0;0t"; return 0; }
|
||||||
alias ls='ls -G'
|
alias ls='ls -G'
|
||||||
for p in /usr/local/*/bin /usr/*/bin /usr/local/Cellar/python/*/bin; do
|
|
||||||
export PATH=$p:$PATH
|
python="$(which python)"
|
||||||
|
python_path=""
|
||||||
|
# Find correct python bin path with multiple Pythons installed by Homebrew
|
||||||
|
if [[ $(echo "$python" | grep '^/usr/local/bin') ]]; then
|
||||||
|
# Python comes from Homebrew
|
||||||
|
target=$(readlink "$python")
|
||||||
|
if [[ $? ]]; then
|
||||||
|
# the python binary is a symlink
|
||||||
|
python_path=$(cd "$(dirname "$python")" && cd "$(dirname "$target")" && pwd)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
for p in "$python_path" /usr/local/*/bin /usr/*/bin; do
|
||||||
|
if [[ -n "$p" ]]; then
|
||||||
|
export PATH=$p:$PATH
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
unset p
|
|
||||||
|
unset p python python_path
|
||||||
|
|
||||||
gitx() { open -a GitX $@; }
|
gitx() { open -a GitX $@; }
|
||||||
pdfman() { man -t $1 | open -a /Applications/Preview.app -f; }
|
pdfman() { man -t $1 | open -a /Applications/Preview.app -f; }
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user