我联系了最近修改gnuplot配方的brew维护者。Brew不再允许在配方中使用选项,因此"brew install gnuplot --with-x11"不能再执行,但是"brew install gnuplot"会安装qt终端和cairo包中有用的终端,但不会安装x11终端。我在几个小时内捕捉到了配方出错的情况。现在它已经可以正常工作,但没有办法安装x11终端。(如果有人愿意维护该配方,这可能是值得的)。
$ brew reinstall gnuplot
==> Reinstalling gnuplot
==> Downloading https://downloads.sourceforge.net/project/gnuplot/gnuplot/5.2.7/gnuplot-5.2.7.tar.gz
==> Downloading from https://versaweb.dl.sourceforge.net/project/gnuplot/gnuplot/5.2.7/gnuplot-5.2.7.tar.gz
######################################################################## 100.0%
==> ./configure --disable-silent-rules --prefix=~/brew/Cellar/gnuplot/5.2.7_1 --with-readline=~/brew/opt/readline --without-tutorial --disable-wxwidgets --with-qt --without-x
==> make
==> make install
~/brew/Cellar/gnuplot/5.2.7_1: 48 files, 2.9MB, built in 1 minute 47 seconds
卸载gnuplot,下载包,按照您的喜好进行配置,并手动重新安装到brew位置:
brew uninstall gnuplot
### Downloading sources
mkdir ~/src
cd ~/src
wget https://downloads.sourceforge.net/project/gnuplot/gnuplot/5.2.7/gnuplot-5.2.7.tar.gz
tar zxvf gnuplot-5.2.7.tar.gz
cd gnuplot-5.2.7
### Configuring with x11
./configure --disable-silent-rules --prefix=~/brew/Cellar/gnuplot/5.2.7_1 --with-readline=~/brew/opt/readline --without-tutorial --with-cairo --with-qt --with-x
### Uninstall gnuplot from brew and install the substitute
make -j
make install # installs to the same location where brew would
brew link gnuplot
我不知道官方的说法/故事/解释,只是通过实验得出了以下结论。如果有人知道更好的方法,请告诉我,我会删除这个。
我刚刚运行了brew info gnuplot
,X11
和Qt
选项都存在。然后我运行了brew update
,它们确实消失了。我注意到brew info gnuplot
现在显示Qt
为“必需”。
所以,我用brew rm gnuplot
移除了gnuplot,然后再次使用brew install gnuplot
安装它,并安装了所需但迄今缺失的依赖项Qt
。
如果我现在执行:
export GNUTERM=qt
gnuplot
Terminal type is now 'qt'
gnuplot> plot sin(x)
经过多次尝试,我唯一的方法是删除gnuplot并使用homebrew重新安装。但是,如果我执行brew install gnuplot
,会出现错误提示说/usr/local不可写,并且我无法更改/usr/local的权限。所以我使用了这里的方法here。
因此,对我有效的顺序是:
使用相应的方法卸载gnuplot。
使用以下命令卸载homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
重新安装homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
使用以下命令安装gnuplot:
brew install gnuplot