I have just noticed that command line utilities such as
/bin/cat), etc. are very slow when I run them from Terminal or iTerm on my MacBook. For example:
ls'ing while in an empty directory takes 1 second (it also takes 1 second in a non-empty directory, both with lots of files or with a few files);
touch'ing a new file takes 1 second (it also takes 1 second to
touchan existing file);
cat'ing an empty file takes 1 second (there is also a 1 second lag before anything happens when I
cata non-empty file).
I have tried to diagnose this in many ways but to no avail. I do not think this is a filesystem issue, since:
I have run Disk Utility and it reports no problems.
Everything seems to be working just fine in Finder, e.g. directory contents are shown instantaneously in Finder.
I installed GNU coreutils using Homebrew and tried using
gcat, etc., and all of the operations I listed above happen instantaneously when run with the GNU version instead.
Any ideas on what could be going on? Any ideas on how to fix this?
EDIT: When I reboot the computer, or try a different user, these issues go away temporarily, but after a few minutes they seem to reappear again. Another strange thing that I noticed:
$ time date Wed Jan 28 10:07:11 PST 2015 real 0m0.151s user 0m0.001s sys 0m0.003s $ time date Wed Jan 28 10:07:13 PST 2015 real 0m0.029s user 0m0.001s sys 0m0.002s $ time date Wed Jan 28 10:07:16 PST 2015 real 0m1.005s user 0m0.001s sys 0m0.002s $ time date Wed Jan 28 10:07:18 PST 2015 real 0m1.005s user 0m0.001s sys 0m0.002s
This happens for all the utilities I've tried,
cat, etc.: The first time I run it after a reboot, it's medium-slow. The second time I run it, it's sorta-fast. All subsequent times I run it, it's slow.