Mathematica中文论坛-非官方

标题: 豆粑粑 macos sed -i not work [打印本页]

作者: meatball1982    时间: 2021-9-4 08:07
标题: 豆粑粑 macos sed -i not work
MacOS 用的是BSD的sed.Ubuntu 用的GNU的sed.
习惯了gnu的,BSD的总有些小问题。
于是,根据下面的帖子在MacOS上安装 gnu-sed

  1. $ which sed              
  2. /usr/bin/sed

  3. $ brew install gnu-sed


  4. $ brew info gnu-sed
  5. ...
  6. GNU "sed" has been installed as "gsed".
  7. If you need to use it as "sed", you can add a "gnubin" directory
  8. to your PATH from your bashrc like:
  9. PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
  10. ...

  11. $ export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"

  12. $ which sed                                                         
  13. /usr/local/opt/gnu-sed/libexec/gnubin/sed
复制代码

需要注意的是,在MacOS下,不是
vi ~/.bashrc
而是
vi ~/.bash_profile
编辑后
source ~/.bash_profile



https://medium.com/@bramblexu/in ... efault-7c17ef1b8f64






欢迎光临 Mathematica中文论坛-非官方 (http://www.ilovemathematica.com/) Powered by Discuz! X3.2