An open community 
of Macintosh users,
for Macintosh users.

FineTunedMac Dashboard widget now available! Download Here

Topic Options
#20081 - 01/12/12 11:55 PM I locked Safari's cache... Or did I?
artie505 Online


Registered: 08/04/09
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.
_________________________
The new Great Equalizer is the SEND button.

Top
#20084 - 01/13/12 07:22 AM Re: I locked Safari's cache... Or did I? [Re: artie505]
Hal Itosis Offline


Registered: 09/03/09
Loc: 10.6.8 (build 10K549)
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.


Edited by Hal Itosis (01/13/12 07:50 AM)

Top
#20086 - 01/13/12 08:01 AM Re: I locked Safari's cache... Or did I? [Re: artie505]
Hal Itosis Offline


Registered: 09/03/09
Loc: 10.6.8 (build 10K549)
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.]


Edited by Hal Itosis (01/13/12 08:07 AM)

Top
#20091 - 01/14/12 12:00 AM Re: I locked Safari's cache... Or did I? [Re: Hal Itosis]
artie505 Online


Registered: 08/04/09
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?
_________________________
The new Great Equalizer is the SEND button.

Top
#20092 - 01/14/12 12:14 AM Re: I locked Safari's cache... Or did I? [Re: Hal Itosis]
artie505 Online


Registered: 08/04/09
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.)
_________________________
The new Great Equalizer is the SEND button.

Top
#20093 - 01/14/12 06:05 AM Re: I locked Safari's cache... Or did I? [Re: artie505]
Hal Itosis Offline


Registered: 09/03/09
Loc: 10.6.8 (build 10K549)
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.


Edited by Hal Itosis (01/14/12 06:36 AM)

Top
#20094 - 01/14/12 06:29 AM Re: I locked Safari's cache... Or did I? [Re: artie505]
Hal Itosis Offline


Registered: 09/03/09
Loc: 10.6.8 (build 10K549)
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).


Edited by Hal Itosis (01/14/12 06:39 AM)

Top
#20095 - 01/14/12 06:37 AM Re: I locked Safari's cache... Or did I? [Re: Hal Itosis]
artie505 Online


Registered: 08/04/09
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?)
_________________________
The new Great Equalizer is the SEND button.

Top
#20096 - 01/14/12 06:43 AM Re: I locked Safari's cache... Or did I? [Re: Hal Itosis]
artie505 Online


Registered: 08/04/09
> 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?
_________________________
The new Great Equalizer is the SEND button.

Top
#20097 - 01/14/12 06:48 AM Re: I locked Safari's cache... Or did I? [Re: artie505]
Hal Itosis Offline


Registered: 09/03/09
Loc: 10.6.8 (build 10K549)
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.

Top
#20098 - 01/14/12 06:49 AM Re: I locked Safari's cache... Or did I? [Re: Hal Itosis]
artie505 Online


Registered: 08/04/09
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).
_________________________
The new Great Equalizer is the SEND button.

Top
#20099 - 01/14/12 06:50 AM Re: I locked Safari's cache... Or did I? [Re: artie505]
Hal Itosis Offline


Registered: 09/03/09
Loc: 10.6.8 (build 10K549)
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.

Top
#20100 - 01/14/12 06:59 AM Re: I locked Safari's cache... Or did I? [Re: Hal Itosis]
artie505 Online


Registered: 08/04/09
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.")
_________________________
The new Great Equalizer is the SEND button.

Top
#20101 - 01/14/12 07:04 AM Re: I locked Safari's cache... Or did I? [Re: Hal Itosis]
artie505 Online


Registered: 08/04/09
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.
_________________________
The new Great Equalizer is the SEND button.

Top
#20102 - 01/14/12 08:28 AM Re: I locked Safari's cache... Or did I? [Re: artie505]
Hal Itosis Offline


Registered: 09/03/09
Loc: 10.6.8 (build 10K549)
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.]




Edited by Hal Itosis (01/14/12 08:39 AM)
Edit Reason: oops ; changed > to >> and changed soft quotes to hard quotes

Top
#20103 - 01/14/12 08:40 AM Re: I locked Safari's cache... Or did I? [Re: Hal Itosis]
Hal Itosis Offline


Registered: 09/03/09
Loc: 10.6.8 (build 10K549)
rats --- i had to edit that previous message twice.

seems i got there in time.

Top
#20105 - 01/14/12 09:42 PM Re: I locked Safari's cache... Or did I? [Re: Hal Itosis]
artie505 Online


Registered: 08/04/09
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.


Edited by artie505 (01/14/12 09:45 PM)
Edit Reason: Expand code section
_________________________
The new Great Equalizer is the SEND button.

Top
#20106 - 01/14/12 10:03 PM Re: I locked Safari's cache... Or did I? [Re: Hal Itosis]
artie505 Online


Registered: 08/04/09
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$ 
_________________________
The new Great Equalizer is the SEND button.

Top
#20107 - 01/14/12 11:37 PM Re: I locked Safari's cache... Or did I? [Re: Hal Itosis]
artie505 Online


Registered: 08/04/09
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.
_________________________
The new Great Equalizer is the SEND button.

Top
#20108 - 01/15/12 12:14 AM Re: I locked Safari's cache... Or did I? [Re: artie505]
artie505 Online


Registered: 08/04/09
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.
_________________________
The new Great Equalizer is the SEND button.

Top

Moderator:  alternaut, dianne, MacManiac