美文网首页
mac下创建bash_profile文件

mac下创建bash_profile文件

作者: 24K纯城 | 来源:发表于2020-02-24 13:48 被阅读0次

启动终端Terminal

进入当前用户的home目录

输入cd ~

创建.bash_profile

输入touch .bash_profile

编辑.bash_profile文件

输入open .bash_profile

第一种方式

<1>、为在弹出的.bash_profile文件内进行编辑

<2>、编辑完成后直接保存文件

<3>、关闭.bash_profile文件

<4>、更新配置过的环境变量    输入source .bash_profile

在.bash_profile文件为锁定状态的时候,第一种方式是不可行的,那么用第二种方式来编辑.bash_profile文件

第二种方式,在Terminal终端通过指令来对.bash_profile文件进行编辑

<1>、输入 vim .bash_profile

<2>、输入 i 进行编辑模式

<3>、然后把需要编辑的内容键入,编辑完之后直接按esc退出编辑模式,

<4>、输入:w进行文件的保存,:wq为保存并退出指令

备注:在实际开发过程中,遇到了没有写入权限的问题

相关文章

网友评论

      本文标题:mac下创建bash_profile文件

      本文链接:https://www.haomeiwen.com/subject/aeqvqhtx.html