mac-profile

简介: Mac 中定义与Linux一样的profile.d首先Mac是没有profile.d的在/etc/profile文件中添加for sh in /etc/profile.d/*sh; do [ -r $sh ] && .

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

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

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

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

mac 原生的配置path的方法

  • 看一下/etc/paths和/etc/paths.d就知道了
  • 推荐使用这个
目录
相关文章
|
11月前
|
Mac 配置环境变量
Mac 配置环境变量
105 0
Mac下安装与使用DbSchema
Mac下安装与使用DbSchema
241 0
MAC可以在.zshrc中修改PATH
MAC可以在.zshrc中修改PATH
362 0
Mac - Mac 下查看文件的绝对路径教辅
Mac - Mac 下查看文件的绝对路径教辅
452 0
Mac - Mac 下查看文件的绝对路径教辅