mac系统设置alias

编辑vim ~/.bash_profile
写入需要的命令

alias mio="cd /Users/miofly/Documents/mio"

使配置生效

source ~/.bash_profile

问题:
自己在 ~/.bash_profile 中配置环境变量, 可是每次重启终端后配置的不生效.需要重新执行 : $source ~/.bash_profile后,才会生效。
原因:
自己是在bash中配置的环境变量,而当前系统是使用的是shell
查看当前使用的shell:
终端输入:echo $SHELL
输出是/bin/zsh,说明使用的是zsh
解决办法:
在.zshrc文件加中添加source ~/.bash_profile,方法如下
进入主目录 cd ~
显示隐藏文件,找到.zshrc文件夹 ls -a(如果没有可以只直接创建)
编辑文件 vi .zshrc
按i进入编辑模式,加入source ~/.bash_profile后,esc,再输入:wq保存退出

猜你喜欢

转载自blog.csdn.net/weixin_40013817/article/details/115269562