Recently I've done clean reinstall of MacOS and naturally I copied all of my important files to external drive and copied them back once I had a clean installed system. The problem is when I type ls in terminal to see my files all the directories have weird colour and all files are executable even though some of them didn't have that flag. Notice how all the directories in my home directory have normal colour to them and how the copied ones (in BashProfile directory) have a weird colour. directories' colours

Also all the files that I've copied became executable (you can tell by the bright green colour) but of course the ones I copied into the directory not from external drive but from my home directory are normal like they are supposed to be. files

You can see that all my .jpg files are executable for some reason. .jpgs

I am using this settings in my .bash_profile :

export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad

My question is: Why were my directories and files affected when I copied them from external hard drive, what do this different colours mean on my directories and is there any possibility that I can revert this changes?

I am running MacOS Mojave

wiktor Pictures $ echo $LSCOLORS

Also files that are green are indeed executable in contrast to white coloured files. enter image description here enter image description here And my drive's format is ExFAT

  • What does 'ls -l' show for these files. What format was the external hard drive?
    – mmmmmm
    Feb 13, 2019 at 17:26
  • Colors don't determine if something is exectuable or not. Please post the output of ls -la to actually see the attributes. Also, please post the results of the command echo $LSCOLORS
    – Allan
    Feb 13, 2019 at 17:27

1 Answer 1


The filesystem on the external storage device does not have a sense of Unix permissions. For example, the external drive may be formatted as one of the FAT variants of filesystems. When you copy the file from the external storage to the Mac's hard drive, it copies the permissions as they were found on the external drive.

Use the idea below or variants of it change the permissions back to something standard on a Unix filesystem. Below, change all files in ~/Pictures with the extension, png, to 0644 (owner = read write, group = read, others = read) and directories to 0755 (owner = read write execute, group read execute, other = read execute). In context of directories, execute provides the ability to change directory (cd) into the given directory. These are typical, default permissions.

find ~/Pictures -type f -name '*.png' -exec chmod 0644 {} +
find ~/Pictures -type d -exec chmod 0755 {} + 

The type option, above, takes an abbreviated file type argument; f specifies regular files, and d specifies directories. The -exec option specifies what to do with found files. In this case, we want to "change mode" (chmod or change permissions). The {} is a list of found files. Use man find and man chmod for more information. Another nice resource for Unix commands is explainshell.com.

Some of the files may require the execute bit. For example, if you have a script that you want to execute directly, use something such as the following (owner = read write execute, group = read execute, others = read execute).

chmod 0755 script.sh

The permissions above are written in octal notation. Wikipedia has a nice summary of the meanings. After getting the permissions back to normal, the colors can provide the right visual hints again.

  • Indeed my drive's format is ExFAT
    – Victor
    Feb 13, 2019 at 17:47
  • Thank you, running find ~/Pictures -type d -exec chmod 0755 {} + in all of my copied directories "reverted the colours" of my directories. And find ~/Pictures -type f -name '*.png' -exec chmod 0644 {} + reverted the changes made by the drive back.
    – Victor
    Feb 13, 2019 at 18:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .