为了全局设MongoDB的路径,mac下修改bashrc来配环境变量的心酸历程

博主在Mac环境下为MongoDB设置全局路径遇到问题,尝试通过修改.bashrc或.base_profile文件失败,后经朋友提醒在/etc找到bashrc文件并使用sudo编辑,解决了权限问题和误操作导致的语法错误,最终成功配置MongoDB环境变量。
摘要由CSDN通过智能技术生成

昨天配Mongodb是终端手动打的export PATH=xxxxx,但还是想找一个一劳永逸的方法。过程中颇多纠结,这里小记一笔吧。

mac下登入终端后直接进入Users/yourUserName 目录,在这里直接 ls - al 找.bashrc文件或者.base_profile文件。然并卵,没找到。touch .base_profile && vim .base_profile 后加入配置全局路径的那一行代码(我的是export PATH=/Users/gege/playground/mongodb/bin:$PATH),然后重启终端,执行Mongo, 命令未找到。同样的方法尝试新建 && 改bashrc文件也没用。但旁边的小姐姐说她的MAC PRO这么做可以,那我就不知道了。可能电脑上的一些配置啊命令啊不一样吧。

.bash_profile和bashrc的区别

.bash_profile is executed for login shells, while .bashrc is executed for interactive non-login shells.

When you login (type username and password) via console, either sitting at the machine, or remotely via ssh: .bash_profile is executed to configure your shell before the initial command prompt.

But, if you’ve already logged into your machine an
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值