Answers like this one show that on a Mac, .bash_profile
gets run every time a new terminal window opens.
Is there a shell config file for Mac OS that only runs when Terminal.app starts running and doesn't run for every new terminal window?
Answers like this one show that on a Mac, .bash_profile
gets run every time a new terminal window opens.
Is there a shell config file for Mac OS that only runs when Terminal.app starts running and doesn't run for every new terminal window?
Is there a shell config file for Mac OS that only runs when Terminal.app starts running and doesn't run for every new terminal window?
There isn't, and there's no need to.
In Linux, the GUI frontend acts as a sh
login shell, executing /etc/profile
and ~/.profile
. Any shell run in a terminal emulator in that session will thus inherit the resulting environment.
In MacOS, the GUI frontend does not do that. So to compenstate, Terminal.app is set up by default to run a shell inside it as a login shell, creating its own "login session" with the necessary environment.
As such, there's no need to run anything separately on Teminal.app's start.