标签:cli 解决 mac 参考 environ curl env ast bsp
问题:
用Eclipse时候读取不到 ~/.bash_profile 下定义的环境变量,确切的说,是GUI应用读取不到终端的(如eclipse)
解决:
1,下载启动代理器:
curl https://raw.githubusercontent.com/ersiner/osx-env-sync/master/osx-env-sync.plist -o ~/Library/LaunchAgents/osx-env-sync.plist
2,下载shell脚本(osx-env-sync.sh)
curl https://raw.githubusercontent.com/ersiner/osx-env-sync/master/osx-env-sync.sh -o ~/.osx-env-sync.sh
3,给shell脚本赋予执行权限
chmod +x ~/.osx-env-sync.sh
4,加载shell脚本到当前环境
launchctl load ~/Library/LaunchAgents/osx-env-sync.plist
修改环境变量后需要重新启动脚本
launchctl unload ~/Library/LaunchAgents/osx-env-sync.plist launchctl load ~/Library/LaunchAgents/osx-env-sync.plist
1,把脚本下载到 ~/bin 目录下
curl https://raw.githubusercontent.com/ersiner/osx-env-sync/master/osx-env-sync-now -o ~/bin/osx-env-sync-now
2,在需要重新加载脚本的时候执行命令
./osx-env-sync-now
参考
Environment variables in Mac OS X
标签:cli 解决 mac 参考 environ curl env ast bsp
原文地址:https://www.cnblogs.com/dengshihuang/p/9830593.html