macOS Catalina 10.15(beta) - Why is `.~bash_profile` not sourced by my shell?

喜夏-厌秋 提交于 2019-12-09 07:59:15

问题


I want to set the environment variable I added below the line to ~/.bash_profile and ~/.profile but it didn't work.

export JBOSS_HOME=/Users/{USERNAME}/Desktop/jboss7

Afterward, exit the terminal and open it again when executing echo $JBOSS_HOME I get nothing.


回答1:


Apple has changed the default shell to zsh. Therefore you have to rename your configuration files. .bashrc is now .zshrc and .bash_profile is now .zprofile.




回答2:


I created a new file called

/usr/local/bin/mybash

which contains a wrapper script:

/usr/local/bin/bash --init-file $HOME/.bashrc

I installed this local/bin/bash from HomeBrew.

Full Sequence of Events

brew install bash
echo "/usr/local/bin/bash --init-file $HOME/.bashrc" > /usr/local/bin/mybash
chmod +x /usr/local/bin/mybash

Then I opened the settings for terminal.app [cmd-comma]. Under the General Tab, select the radio button for Command (complete path)

In the text box change the text from /bin/zsh/ to /usr/local/bin/bash.




回答3:


cp zprofile ~/.zprofile

Add to .zprofile:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

eg. by >vi .zprofile

Done



来源:https://stackoverflow.com/questions/56784894/macos-catalina-10-15beta-why-is-bash-profile-not-sourced-by-my-shell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!