且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

mac-profile

更新时间:2022-08-12 16:13:29

Mac 中定义与Linux一样的profile.d

  • 首先Mac是没有profile.d的
  • 在/etc/profile文件中添加

for sh in /etc/profile.d/*sh; do
    [ -r $sh ] && . $sh
done
unset sh
  • install -o root -g wheel -d /etc/profile.d
  • 在该目录下创建一个mysql.sh

export PATH=$PATH:/usr/local/mysql/bin
  • 有一个问题: 可以是Mac不支持profile.d目录的缘故, 所以在profile中执行的都是在子进程中的, 所以无效的, 我们需要在登录shell时执行. /etc/profile文件

mac 原生的配置path的方法

  • 看一下/etc/paths和/etc/paths.d就知道了
  • 推荐使用这个

相关阅读