Search code examples
macosterminalmacportsmacos-sierrabash

Mac OS Sierra with Macports, when changing " ~/.profile " file, i'm losing colors in my terminal (export PATH=...)


I know maybe this is a ridiculous question but i have many folders and executable files in terminal, so i need colors. This is my question;

  • When i export some PATH file like this;

      export PATH=/opt/local/libexec/gnubin/:$progFiles/****/*****/*****/bin:$PATH
    

    I'm losing the colors in my terminal like when i enter a command like "ls" it can't show the colors for the folders and executables etc. all of them are just white. When i close this export command line with # i can see the colors again like a magic. Any help will be appreciated. Thank you.


Solution

  • This probably happens because you prepend /opt/local/libexec/gnubin to $PATH and have the coreutils port installed. The coreutils port installs copies of the usual GNU utilities, among them ls, into /opt/local/bin, but prepends them with a g for GNU.

    Additionally, the coreutils port provides the unprefixed versions in /opt/local/libexec/gnubin. So when you put that first in your $PATH, typing ls will no longer use macOS' BSD ls at /bin/ls, but GNU's ls from /opt/local/libexec/gnubin/ls, which only prints colors if you call it with --colors=auto (which is easily achieved by an alias).

    When you type /bin/ls, you'll likely get the output you are used to.