Iam using Mac OS X 10.5.2. Strangely, i dont have a .bashrc file on the users home folder. So i set out to create one. This is what i did.
First i created .bashrc by doing 'touch .bashrc'. Then i filled the following contents.
# User @ Host - working dir
#export PS1=”\u@\h\w$ ”
export PS1="\u@\h\w: "
In order to force Terminal.app to load .bashrc at the start: i opened terminal.app and then i opened preferences dialog. navigated to the startup section. Then i selected 'shells open with' under 'command(complete path)'. I gave the path as
/bin/bash –-rcfile /Users/pradeep/.bashrc --> pradeep is my username
Then i opened the new terminal window to check if it took effect, but there was no change.
am i doing something wrong ?
Mac Specs: Mac Pro, 3.2 GHz 8 Core, 8 GB RAM, 2*750 GB Disk, nVidia 8800 GT
I didn't have to do anything to my Terminal.app settings to get it to load .bashrc. Bash should do this automatically.
However, I believe that Terminal.app creates login shells. Hence, it will look for and process .bash_profile, not .bashrc. I have a one line .bash_profile in my home directory that just contains the line
Code:
source .bashrc
That does the trick for me.
__________________
My Macs: Mac Pro, 3.2 GHz 8 Core, MacBook Pro, 2.2 GHz C2D
My iStuff: 32 GB iPhone 3G S, 30 GB iPod Video, 16 GB iPod Touch
My OS': Mac OS X Leopard, Mac OS X Tiger, openSUSE 10.3, Win XP
I was on the Mac-Forums honor roll for September 2007
Terminal.app isn't as customizable as standard Unix terminals. You won't really be able to change colors and such as much as you would be able on say Xterm or Urxvt. You may want to just use Xterm through X.
Unless there's a lot of differences between Tiger and Leopard...
Bash will read a .bashrc just fine, assuming you've restarted Terminal.
There's no need to "force" it to read from preferences.
Terminal is very customizable, type "man bash" (without the quotes) in Terminal.
Goto http://www.dotfiles.com/ and look at/download some of the OS X files.
All kinds of ways to customize prompts and more.
My favorite is bash_styles.
Mac Specs: 15" mbp, too many ipods and other stuff
It'll also process .profile automatically.
__________________
mike
Warning: Sharp chisels are dangerous and should be handled with care. Dull chisels are even more dangerous and should be sharpened.
Got # ? phear the command line!
But i don't find .bashrc, .bash_profile and .profile. When i tried loading them as nano .bashrc, i didnt get any tab completion. That's why i tried to create a .bashrc myself.
This is what i did now, i opened bash shell and then typed
bash --rcfile /Users/pradeep/.bashrc (or) bash -i
now the changes i mentioned in .bashrc works!! But when i open the new terminal the changes go away. I think this means it reads off /etc/bashrc first while starting up the machine or while opening a new terminal window, and not ~./bashrc. But ~./bashrc is invoked only when i do bash -i.
If you have a .bash_profile in your home dir, put this in it:
Code:
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
That will make bash read your .bashrc in your home dir.
.bashrc is not in your home dir by default. You are supposed to create one to make changes to your $PATH or to make aliases, etc.
It needs to be plain text and executable as a linux file.
chmod +x .bashrc
will make it executable.
Mac Specs: 15" mbp, too many ipods and other stuff
there won't be any of them by default, you'll have to create them
Try doing a cp -p .bashrc .profile && . ./.profile
__________________
mike
Warning: Sharp chisels are dangerous and should be handled with care. Dull chisels are even more dangerous and should be sharpened.
Got # ? phear the command line!