• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

newb question about osx .bash_profile

Okasa

Member
im trying to set up my terminal window to automatically run code when opened. im running osx 10.3.9, and i have heard many people talk about using ~/.bash_profile however, i cannot seem to get the code, for testing purposes only has "ls", to run when the terminal is launched. source .bash_profile works fine btw. can someone give me a step-by-step instruction on how to set this up? thanks!

p.s. how can i ensure that -noprofile isnt enabled?
 
the ~/.bashrc and the ~/.bash_profile apparently do not come installed with the operating system if i am correct in what i heard, they have to be created by the user. however, i did mess with /etc/profile and /etc/bashrc (the non-hidden one), to no avail.
 
You can copy the ones in /etc to your home directory. The shell is _supposed_ to check for the existance of the files in your home dir and use those if they exist.
 
could you give me the code you have in your .bash_profile, or at least any formatting that i may not know of?
 
Originally posted by: Okasa
could you give me the code you have in your .bash_profile, or at least any formatting that i may not know of?

I'm at work now, but I'll try to remember to see what I can figure out in the morning.

There shouldn't be anything fancy, try something like bash -l in your terminal. If your changes come up, the Terminal.app program isn't making bash a "login" shell. There should be an option to add this or at least add the -l flag to bash in the preferences.
 
those are 2 different things im about 90% sure. mainly as ive seen both, or are you saying i need to put it in "/.profile"?
 
for the time being, ive found i can specify a file to source each time i open a new terminal. for now that will be ok, but im still curious on how to do it properly.
 
Ok, I added ls to /etc/bashrc and it works fine. Apparently it doesn't check ~/.bashrc. To get it to do so, add the following to /etc/bashrc

if [ -e "${HOME}/.bashrc" ] ; then
source ${HOME}/.bashrc
fi
 
Like I said, it's ~/.profile. On linux systems it's ~/.bashrc, but OS X, being based on BSD uses ~/.profile. Try it.

BTW, ~/.bashrc works in xterm in X11.
 
Originally posted by: hopejr
Like I said, it's ~/.profile. On linux systems it's ~/.bashrc, but OS X, being based on BSD uses ~/.profile. Try it.

BTW, ~/.bashrc works in xterm in X11.

I wonder why Apple changed that, bash should be the same no matter what platform you use. :|
 
Back
Top