做做网站下载免费,深圳今天新增确诊名单,百度seo可能消失,网络品牌推广策略前言
使用MAC idea2025.2 tomcat8 设置环境变量#xff0c;启动失效问题解决
分析
网上说是zsh和bash命令问题#xff0c;但是尝试多次覆盖文件#xff0c;启动读取依然没用 MAC下#xff5e;/.bash_profile无效 ~/.bash_profile配置无问题#xff0c;为何每次打开新的…前言
使用MAC idea2025.2 tomcat8 设置环境变量启动失效问题解决
分析
网上说是zsh和bash命令问题但是尝试多次覆盖文件启动读取依然没用 MAC下/.bash_profile无效 ~/.bash_profile配置无问题为何每次打开新的终端都需要source /.bash_profile 才可以生效呢
1
chsh -s /bin/bash
2
cd ~
ls .zshrc
vim .zshrc
写入source ~/.bash_profile
:wq 进行关闭
bash_profile 每次打开都是空的或者就算有但是idea启动读取还是空的
原因
在 macOS 下终端中的环境变量是通过 shell 配置文件~/.zshrc 或 ~/.bash_profile加载的 但是IDEA 是通过 GUI 启动的不会读取这些 shell 配置文件也不会继承你在 Terminal 里设置的变量。 mac idea启动读取不到系统环境变量解决办法
文章要求进入这个文件但是我查看了下并没有索性使用 vim ~/Library/LaunchAgents/environment.plist?xml version1.0 encodingUTF-8?
!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//ENhttp://www.apple.com/DTDs/PropertyList-1.0.dtd
plist version1.0
dictkeyLabel/keystringuser.environment/stringkeyProgramArguments/keyarraystringlaunchctl/stringstringsetenv/stringstringkey/stringstringvalue/string/arraykeyRunAtLoad/keytrue/
/dict
/plist解决
尝试这么多方案也没解决于是选择最基础的方法tomcat配置环境变量这样启动读取的就是自己配置的