[英]Bash in Emacs + OSX not finding gems installed via terminal.app?
我正在osx上的emacs中運行bash,並且從終端和應用程序的另一個位置提取寶石
在bash中:
which gem
/usr/bin/gem
在終端:
which gem
/opt/local/bin/gem
如何更改bash以匹配終端?
我猜emacs bash shell中的$PATH
是不同的。 您可以通過在每個命令中運行此命令來檢出它。
echo $PATH
這是用於查找命令的查找路徑。 您需要在其中包含/ opt / local / bin。
export PATH="/opt/local/bin:$PATH"
將該行放在~/.bashrc
文件中,當在emacs中使用時,bash應該將其拾取(除非它是由其他用戶或其他人運行的)。
更新:
正如評論中提到的Singletoned一樣,Emacs不會加載~/.bash_profile
或~/.profile
但是終端會加載。 該文件可能已經包含此PATH
定義,導致兩者具有不同的行為。
我建議將PATH定義從bash_profile
文件移動到bashrc
。 但是,如果bash_profile
存在,終端將不會加載bashrc
。
解決方案是將其添加到~/.bash_profile
。
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
然后,您可以將其他所有內容移動到bashrc
,該內容將包含在bash_profile
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.