3
我的$ PATH变量是如何在macOS上构建的?
我最近在我的Mac上安装了Homebrew,它抱怨在我的变量/usr/bin之前发生,这意味着将使用系统提供的程序而不是使用Homebrew安装的程序。/usr/local/bin$PATH .bashrc根据此截屏视频,我在一组单独的文件中配置。这意味着~/.bash_profile看起来像这样: if [ -f ~/.bashrc ]; then source ~/.bashrc fi ~/.bashrc 看起来像这样: source ~/bin/dotfiles/bashrc 并且~/bin/dotfiles/bashrc看起来是这样的: . ~/bin/dotfiles/bash/env . ~/bin/dotfiles/bash/config . ~/bin/dotfiles/bash/aliases ~/bin/dotfiles/bash/env,这是我设置我的$PATH变量,看起来像这样: export EDITOR="kom" export PATH=some/path/at/start:usr/local/bin:/Users/jim/pear/bin:~/bin:/Users/jim/.gem/ruby/1.8/bin:/Users/jim/bin/bashscripts:some/path/at/end:$PATH 我已添加some/path/at/start并some/path/at/end用于调试目的,因为当我尝试时,echo $PATH我得到这个: /opt/local/bin:/opt/local/sbin:/Users/jim/bin:/opt/local/bin:/opt/local/sbin:some/path/at/start:usr/local/bin:/Users/jim/pear/bin:/Users/jim/bin:/Users/jim/.gem/ruby/1.8/bin:/Users/jim/bin/bashscripts:some/path/at/end:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin 也就是说,在我上面概述的配置中,有一些其他东西被加载到$ PATH变量中,我无法控制。关于这些东西从哪里加载的任何想法,以便我可以去改变它并移动/usr/local/bin之前/usr/bin?