1. 程式人生 > >解決MacOS下readlink: illegal option -- f

解決MacOS下readlink: illegal option -- f

Mac下的readlink沒有-f引數,諸如screenfetch又會去呼叫readlink -f,於是每次都會出現:

readlink: illegal option -- f
usage: readlink [-n] [file ...]

很是煩人,解決方案如下:
1.安裝coreutils:

brew install coreutils

2.設定環境變數,編輯~/.bash_profile,新增:

export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

3.建立別名,使用greadlink替代readlink,同樣是編輯~/.bash_profile,新增:

alias readlink=greadlink