No .bash_profile on my Mac

Viewed 58224

I'm trying to develop using Eclipse/Maven on my Mac and while setting environment variables there is no .bash_profile. I do ls -a and still not there. I see a .bash_history and .bash_sessions. Where am I supposed to set my JAVA_HOME and PATH?

Thank you!

3 Answers

In your terminal:

touch ~/.bash_profile; open ~/.bash_profile

Then make your edits and save. This is generic so make sure your path is correct in the above example.

For anyone else stumbling up on this after Mac Catalina,

Starting CATALINA the default shell is zsh. The profile file name for zsh is ~/.zprofile.

To setup bash as your default:

  1. Open terminal
  2. Goto preferences and choose "Shell opens with"
  3. Click on "Command(complete path)" and type "/bin/bash" to start bash shell

On terminal, enter this command: chsh -s /bin/bash

This will change shell for the current user to bash.

After that, you can see .bash_profile on the root folder.

Related