Home
Posted By: artie505 I locked Safari's cache... Or did I? - 01/13/12 07:55 AM
I got so sick of seeing all the tracking stuff stashed in /Users/artie/Library/Caches/com.apple.Safari/Cache.db that I locked it, but I still see the same tracking stuff listed in Safari > Prefs > Privacy > Cookies and other website data > Details.

Can anybody explain what's up with that, i.e. from where is "Privacy" picking those items up, and are they functional?

Thanks.
Posted By: Hal Itosis Re: I locked Safari's cache... Or did I? - 01/13/12 03:22 PM
Originally Posted By: artie505
I got so sick of seeing all the tracking stuff stashed in /Users/artie/Library/Caches/com.apple.Safari/Cache.db that I locked it, but I still see the same tracking stuff listed in Safari > Prefs > Privacy > Cookies and other website data > Details.

Can anybody explain what's up with that, i.e. from where is "Privacy" picking those items up, and are they functional?

Stuff?

How about some concrete examples of stuff?

Note: i don't know why Apple displays cached items within the cookie list (i think it's dumb to treat users like dummies). They should put tabs there to segregate cookies from all that “other website data” : local storage, cache and those so-called plug-in items (from your other thread). But i suggest emptying the cache (⌘⌥E) before even looking at that list.


BTW (just a guess, but), maybe locking that Cache.db file forces Safari to use more RAM.
Posted By: Hal Itosis Re: I locked Safari's cache... Or did I? - 01/13/12 04:01 PM
FWIW, here is my Cookie Counter pipeline command:
Code:
sed 's/[[:cntrl:]]//g' ~/Library/Cookies/Cookies.plist |
  awk -F. '/Domain/ { getline; print $(NF-1) "." $NF }' |
    sed 's/<[^<]*>//g' |sort -b -d -f -i |uniq -c |
      awk -v tot=0 '{ tot += $1; print $0 }
        END { print(" === =====================\n",
          tot, "cookies in", NR, "domains") }' |
            pr -3 -t -i100 -o1 -w96


Just paste that code into a text file named cc, make it executable (chmod a+x) and put it in your $PATH somewhere. Then simply typing cc in Terminal will display a true cookie count. [note: terminal window must be at least 96-chars wide to avoid wrapping, and even then, domain names longer than 26-chars will be truncated. E.g., facebookapplicationdevelopment.org will be printed as facebookapplicationdevelop.]

One could also copy/paste that text directly into Terminal... but it's much easier to save as a file and then just type cc

[either way, that pipeline is totally "safe" in that it only reads stuff... i.e., no data anywhere is altered one bit.]
Posted By: artie505 Re: I locked Safari's cache... Or did I? - 01/14/12 08:00 AM
Originally Posted By: Hal Itosis
Originally Posted By: artie505
I got so sick of seeing all the tracking stuff stashed in /Users/artie/Library/Caches/com.apple.Safari/Cache.db that I locked it, but I still see the same tracking stuff listed in Safari > Prefs > Privacy > Cookies and other website data > Details.

Can anybody explain what's up with that, i.e. from where is "Privacy" picking those items up, and are they functional?

Stuff?

How about some concrete examples of stuff?

By way of example, and all identified as "Cache:"

yieldmanager.com
typekit.com
ru4.com
paypalobjects.com
media6degrees.com
invitemedia.com
interclick.com
imrworldwide.com
gstatic.com
googleapis.com
googleadservices.com
get.it
fwix.com
bluekai.com
as5000.com

Originally Posted By: Hal Itosis
Note: i don't know why Apple displays cached items within the cookie list (i think it's dumb to treat users like dummies). They should put tabs there to segregate cookies from all that “other website data” : local storage, cache and those so-called plug-in items (from your other thread).

I agree with you about Apple's display prefs, which have left us unable to, for instance, delete a Web site's cache items but leave its cookies intact.

Further, I don't understand why each Web site's individual cookies are no longer displayed as used to be the case under Safari's "Security" tab.

Originally Posted By: Hal Itosis
But i suggest emptying the cache (⌘⌥E) before even looking at that list.

I do that many times a day, but that kinda introduces cookies into a cache thread and gets away from my original question...

From where is "Privacy" picking up those supposedly blocked caches, and are they functional despite my having locked my cache file? (If they are, isn't the lock not only useless, but causing slower page loading times as well?)

Originally Posted By: Hal Itosis
BTW (just a guess, but), maybe locking that Cache.db file forces Safari to use more RAM.

You're suggesting that as a result of my having locked my cache file Safari is storing cache items in RAM?
Posted By: artie505 Re: I locked Safari's cache... Or did I? - 01/14/12 08:14 AM
Originally Posted By: Hal Itosis
FWIW, here is my Cookie Counter pipeline command:
Code:
sed 's/[[:cntrl:]]//g' ~/Library/Cookies/Cookies.plist |
  awk -F. '/Domain/ { getline; print $(NF-1) "." $NF }' |
    sed 's/<[^<]*>//g' |sort -b -d -f -i |uniq -c |
      awk -v tot=0 '{ tot += $1; print $0 }
        END { print(" === =====================\n",
          tot, "cookies in", NR, "domains") }' |
            pr -3 -t -i100 -o1 -w96


Just paste that code into a text file named cc, make it executable (chmod a+x) and put it in your $PATH somewhere. Then simply typing cc in Terminal will display a true cookie count. [note: terminal window must be at least 96-chars wide to avoid wrapping, and even then, domain names longer than 26-chars will be truncated. E.g., facebookapplicationdevelopment.org will be printed as facebookapplicationdevelop.]

One could also copy/paste that text directly into Terminal... but it's much easier to save as a file and then just type cc

[either way, that pipeline is totally "safe" in that it only reads stuff... i.e., no data anywhere is altered one bit.]

Thanks for that, but what am I doing wrong?

Code:
Last login: Sat Jan 14 02:30:26 on ttys000
Artie-s-Computer-4:~ artie$ chmod a+x /Users/artie/Desktop/cc.txt 
Artie-s-Computer-4:~ artie$ 

and "cc" is still not executable.

And I'm afraid that "$PATH" is a bit beyond my experience; does it mean /bin?

(I'm prepping to start another thread that deals with cookies and will get into the "guts" of your command, but don't hold your breath.)
Posted By: Hal Itosis Re: I locked Safari's cache... Or did I? - 01/14/12 02:05 PM
Originally Posted By: artie505
Thanks for that, but what am I doing wrong?

Code:
Last login: Sat Jan 14 02:30:26 on ttys000
Artie-s-Computer-4:~ artie$ chmod a+x /Users/artie/Desktop/cc.txt 
Artie-s-Computer-4:~ artie$ 

and "cc" is still not executable.

Well —due to that .txt extension —cc doesn't exist (but cc.txt does). So if you type the full path ~/Desktop/cc.txt then it will execute. Better yet, remove (not just hide) the extension completely.

Originally Posted By: artie505
And I'm afraid that "$PATH" is a bit beyond my experience; does it mean /bin?

Yes, /bin is typically always part of $PATH. That's why we can simply type ls instead of needing to type /bin/ls every time. Rather than tapping out all the details on my iPad, i offer this link:

http://hayne.net/MacDev/Notes/unixFAQ.html

Edit: note that users should not place custom shell scripts in /bin but rather into /usr/local/bin (or, create their own ~/bin folder) and then modify $PATH accordingly.
Posted By: Hal Itosis Re: I locked Safari's cache... Or did I? - 01/14/12 02:29 PM
Originally Posted By: artie505
By way of example, and all identified as "Cache:"

yieldmanager.com
typekit.com
ru4.com
paypalobjects.com
media6degrees.com
invitemedia.com
interclick.com
imrworldwide.com
gstatic.com
googleapis.com
googleadservices.com
get.it
fwix.com
bluekai.com
as5000.com

You're suggesting that as a result of my having locked my cache file Safari is storing cache items in RAM?

Haven't actually tested... but did that locked cache.db file remain locked and unmodified? Or did Safari simply unlock and modify it?

If it was still locked and unmodified, then Safari must be fabricating that mixed list from items stored somewhere (and RAM seemed like a logical guess).
Posted By: artie505 Re: I locked Safari's cache... Or did I? - 01/14/12 02:37 PM
Originally Posted By: Hal Itosis
Originally Posted By: artie505
Thanks for that, but what am I doing wrong?

Code:
Last login: Sat Jan 14 02:30:26 on ttys000
Artie-s-Computer-4:~ artie$ chmod a+x /Users/artie/Desktop/cc.txt 
Artie-s-Computer-4:~ artie$ 

and "cc" is still not executable.

Well —due to that .txt extension —cc doesn't exist (but cc.txt does). So if you type the full path ~/Desktop/cc.txt then it will execute. Better yet, remove (not just hide) the extension completely.

Originally Posted By: artie505
And I'm afraid that "$PATH" is a bit beyond my experience; does it mean /bin?

Yes, /bin is typically always part of $PATH. That's why we can simply type ls instead of needing to type /bin/ls every time. Rather than tapping out all the details on my iPad, i offer this link:

http://hayne.net/MacDev/Notes/unixFAQ.html

Got it! Many thanks. cool

The .txt icon changed to a Unix executable icon as soon as I removed the .txt; did I still have to chmod?

(I don't follow So if you type the full path ~/Desktop/cc.txt then it will execute. Isn't that what I did when it wouldn't execute?)
Posted By: artie505 Re: I locked Safari's cache... Or did I? - 01/14/12 02:43 PM
> Edit: note that users should not place custom shell scripts in /bin but rather into /usr/local/bin (or, create their own ~/bin folder) and then modify $PATH accordingly.

So I should remove cc from /bin, where I've already placed it?
Posted By: Hal Itosis Re: I locked Safari's cache... Or did I? - 01/14/12 02:48 PM
Originally Posted By: artie505
The .txt icon changed to a Unix executable icon as soon as I removed the .txt; did I still have to chmod?

no, the original chmod you did still holds true.


Originally Posted By: artie505
(I don't follow So if you type the full path ~/Desktop/cc.txt then it will execute. Isn't that what I did when it wouldn't execute?)

I don't see anywhere where you actually tried to execute the cc command.

chmod only sets the x bits... it doesn't run the file.
Posted By: artie505 Re: I locked Safari's cache... Or did I? - 01/14/12 02:49 PM
Originally Posted By: Hal Itosis
Originally Posted By: artie505
By way of example, and all identified as "Cache:"

yieldmanager.com
typekit.com
ru4.com
paypalobjects.com
media6degrees.com
invitemedia.com
interclick.com
imrworldwide.com
gstatic.com
googleapis.com
googleadservices.com
get.it
fwix.com
bluekai.com
as5000.com

You're suggesting that as a result of my having locked my cache file Safari is storing cache items in RAM?

Haven't actually tested... but did that locked cache.db file remain locked and unmodified? Or did Safari simply unlock and modify it?

If it was still locked and unmodified, then Safari must be fabricating that mixed list from items stored somewhere (and RAM seemed like a logical guess).

Yep! /Users/artie/Library/Caches/com.apple.Safari remained locked, and Cache.db remained unmodified, so RAM was a pretty good guess (particularly since Safari does the same thing with cookies...my "somewhere over the rainbow" thread).
Posted By: Hal Itosis Re: I locked Safari's cache... Or did I? - 01/14/12 02:50 PM
Originally Posted By: artie505
> Edit: note that users should not place custom shell scripts in /bin but rather into /usr/local/bin (or, create their own ~/bin folder) and then modify $PATH accordingly.

So I should remove cc from /bin, where I've already placed it?

No biggie... just be aware that /bin is Apple's domain, and any given update might erase cc from that folder.
Posted By: artie505 Re: I locked Safari's cache... Or did I? - 01/14/12 02:59 PM
Originally Posted By: Hal Itosis
Originally Posted By: artie505
(I don't follow So if you type the full path ~/Desktop/cc.txt then it will execute. Isn't that what I did when it wouldn't execute?)

I don't see anywhere where you actually tried to execute the cc command.

chmod only sets the x bits... it doesn't run the file.

I misunderstood you...thought you said to type the full path in the chmod command (which I had done).

I know chmod doesn't run the file, but how would I execute the cc command when it's still in .txt form? (I tried dragging the file into a Terminal window and hitting "Return, but with no luck.")
Posted By: artie505 Re: I locked Safari's cache... Or did I? - 01/14/12 03:04 PM
Originally Posted By: Hal Itosis
Originally Posted By: artie505
> Edit: note that users should not place custom shell scripts in /bin but rather into /usr/local/bin (or, create their own ~/bin folder) and then modify $PATH accordingly.

So I should remove cc from /bin, where I've already placed it?

No biggie... just be aware that /bin is Apple's domain, and any given update might erase cc from that folder.

In that case, I'd prefer to store cc in ~, but I'm not certain what "modify $PATH accordingly" means. (Does it mean that my cc command must be ~/bin/cc rather than just cc?)

Thanks.
Posted By: Hal Itosis Re: I locked Safari's cache... Or did I? - 01/14/12 04:28 PM
Originally Posted By: artie505
I know chmod doesn't run the file, but how would I execute the cc command when it's still in .txt form? (I tried dragging the file into a Terminal window and hitting "Return, but with no luck.")

Instead of telling us about it, showing us the actual terminal text is much preferred. I have a strange feeling that terminal didn't reply with "no luck". smile

At this point (wherever cc is), a listing with ls -l would be useful (to see if it still has x bits or not).

ls -l
/path/to/cc


Originally Posted By: artie505
In that case, I'd prefer to store cc in ~, but I'm not certain what "modify $PATH accordingly" means. (Does it mean that my cc command must be ~/bin/cc rather than just cc?)

Ideally, we would modify your $PATH variable so you'd only need to type cc

As yet unknown is which of the various startup files your bash shell is already using. This is complicated because there are many possibilities. [e.g., i prefer to set my $PATH in a file called ~/.bashrc]

If you show us this, we can see what your setup is:

cd; ls -1 .bash*


But perhaps (without even knowing which startup files you use), this has the best chance of succeeding:

echo 'declare -x PATH=$PATH:~/bin' >> ~/.bash_profile

...after which, (quit and relaunch terminal) and look at:

echo "$PATH"

and /Users/artie/bin should be at the end there. [don't forget to actually create the ~/bin folder and put cc inside it.]


Posted By: Hal Itosis Re: I locked Safari's cache... Or did I? - 01/14/12 04:40 PM
rats --- i had to edit that previous message twice.

seems i got there in time.
Posted By: artie505 Re: I locked Safari's cache... Or did I? - 01/15/12 05:42 AM
Originally Posted By: Hal Itosis
Originally Posted By: artie505
I know chmod doesn't run the file, but how would I execute the cc command when it's still in .txt form? (I tried dragging the file into a Terminal window and hitting "Return, but with no luck.")

Instead of telling us about it, showing us the actual terminal text is much preferred. I have a strange feeling that terminal didn't reply with "no luck". smile


First (before I forget again), thanks for the Hayne of Tintagel link.

OK... I guess I managed to confuse myself and tried to run an un-chmodded version of cc.txt, because a chmodded version runs:

Code:
Last login: Sun Jan 15 01:28:49 on ttys000
Artie-s-Computer-4:~ artie$ /Users/artie/Desktop/cc.txt 
-bash: /Users/artie/Desktop/cc.txt: Permission denied
Artie-s-Computer-4:~ artie$ chmod a+x /Users/artie/Desktop/cc.txt 
Artie-s-Computer-4:~ artie$ /Users/artie/Desktop/cc.txt 
    4 ally.com                      4 google.com                    9 wunderground.com
    5 chase.com                    12 intuit.com                  === =====================
   13 cnet.com                     35 macupdate.com               126 cookies in 11 domains
    9 ebay.com                     23 paypal.com
    3 finetunedmac.com              9 vanguard.com
Artie-s-Computer-4:~ artie$ 

Sorry about the confusion.
Posted By: artie505 Re: I locked Safari's cache... Or did I? - 01/15/12 06:03 AM
Originally Posted By: Hal Itosis
At this point (wherever cc is), a listing with ls -l would be useful (to see if it still has x bits or not).
ls -l /path/to/cc

Originally Posted By: artie505
In that case, I'd prefer to store cc in ~, but I'm not certain what "modify $PATH accordingly" means. (Does it mean that my cc command must be ~/bin/cc rather than just cc?)

Ideally, we would modify your $PATH variable so you'd only need to type cc

As yet unknown is which of the various startup files your bash shell is already using. This is complicated because there are many possibilities. [e.g., i prefer to set my $PATH in a file called ~/.bashrc]

If you show us this, we can see what your setup is:

cd; ls -1 .bash*


But perhaps (without even knowing which startup files you use), this has the best chance of succeeding:

echo 'declare -x PATH=$PATH:~/bin' >> ~/.bash_profile

...after which, (quit and relaunch terminal) and look at:

echo "$PATH"

and /Users/artie/bin should be at the end there. [don't forget to actually create the ~/bin folder and put cc inside it.]

Got it! Many thanks for working through this with me and not only enabling me to accomplish something useful, but to learn something useful in the process. smile

Code:
Last login: Sun Jan 15 01:52:50 on ttys000
Artie-s-Computer-4:~ artie$ cd; ls -1 .bash*
.bash_history
.bash_profile
Artie-s-Computer-4:~ artie$ echo 'declare -x PATH=$PATH:~/bin' >> ~/.bash_profile
Artie-s-Computer-4:~ artie$ 

Code:
Last login: Sun Jan 15 01:55:40 on ttys000
Artie-s-Computer-4:~ artie$ echo "$PATH"
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/artie/bin:/Users/artie/bin
Artie-s-Computer-4:~ artie$ cc
    4 ally.com                      4 google.com                    9 wunderground.com
    5 chase.com                    12 intuit.com                  === =====================
   13 cnet.com                     35 macupdate.com               126 cookies in 11 domains
    9 ebay.com                     23 paypal.com
    3 finetunedmac.com              9 vanguard.com
Artie-s-Computer-4:~ artie$ 
Posted By: artie505 Re: I locked Safari's cache... Or did I? - 01/15/12 07:37 AM
Originally Posted By: Hal Itosis
rats --- i had to edit that previous message twice.

seems i got there in time.

Forgot to mention that you did.

Thanks, again.
Posted By: artie505 Re: I locked Safari's cache... Or did I? - 01/15/12 08:14 AM
Getting back to basics, here, I've now unlocked my cache, because the lock wasn't stoping the junk mail but was slowing loading time.
© FineTunedMac