Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've been trying to decorate my Terminal on my MacOSX 10.7.3. As i surfed and found is to write following color codes into the file called .bash_profile:

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

The problem is WHERE TO SAVE THIS FILE?

share|improve this question
add comment

migrated from stackoverflow.com Jun 6 '12 at 3:34

This question came from our site for professional and enthusiast programmers.

1 Answer

In first place you should use the terminal preferences under the menu Terminal > Preferences > Settings to change this kind of things. (Or maybe not)

If you still want to go text mode, since OS X is UNIX based, you should be able to create the file .bash_profile inside your home directory and it will be loaded.

You need to: touch ~/.bash_profile

Then open the file vi ~/.bash_profile, press i to enter in text insert mode, paste your text and press esc them type :wq, press enter and the file should be saved.

Your options should be like this

export LS_OPTIONS='--color=auto'
export CLICOLOR='Yes'
export LSCOLORS=''
export LSCOLORS='Bxgxfxfxcxdxdxhbadbxbx'
share|improve this answer
1  
Don't link them, since the .bashrc file gets read after .bash_profile on any login terminal. That would cause it to be read twice. If you want something to work everywhere, put it in the .bashrc file. –  Spencer Rathbun Jun 5 '12 at 12:30
    
@SpencerRathbun at least in OSX if I place the options only under .bashrc they won't take effect. Maybe they are overwritten by the setting on the OSX Terminal GUI. Placing them only at .bash_profile works fine for local logins. –  TCB13 Jun 5 '12 at 12:35
    
There's no need to touch the file before you edit it or before you echo >> (append, or even echo > - overwrite). –  Dennis Williamson Jun 5 '12 at 12:45
1  
@TCB13 according to the bash man page, there are various options that can have this effect. The biggest one is that if a shell is a login shell, it does not read .bashrc by default. This is why most people have .bash_profile source .bashrc. See here for an example. –  Spencer Rathbun Jun 5 '12 at 13:04
    
Terminal options will not allow customisation of ls output colours – you can define the colour scheme there, but is mapping to coloured directory listings is up to LSCOLOR. Also note that --color=auto has no effect on OS X whatsoever, as OS X uses BSD’s external ls command. The correct option for coloured output with that is -G, but that isn’t needed either, as it is equivalent to setting CLICOLOR (see the ls man page). –  kopischke Jun 8 '12 at 16:36
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.