Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Clear recent items in Lion

Most apps (Text Editor, QuickTime, Preview, etc) seems to keep the last 10 items in the contextual menu. I tried opening the specific app "Open Recent -> Clear Menu" and restart the app - but no luck.


I also tried to change the number of recent items to "None" in the System Preferences > General > Number of Recent Items - but that did not help either.


Any suggestions?

Mac OS X (10.7)

Posted on Jul 22, 2011 10:41 AM

Reply
Question marked as Best reply

Posted on Jul 24, 2011 4:36 PM

Unfortunately you have to open each application, go File>Open Recent>Clear Menu. The items will still show until you restart your system.


Apple seem to have no concept that you might want to keep your history private.

29 replies

Aug 15, 2011 1:53 AM in response to hellomesss

"Lion lists recent items with each application in the Dock (accessible via right-click) and in the Application View of Mission Control. To remove those and disable future additions, run the following commands in the Terminal. Note that to figure out the application's bundle identifier, you can open Activity Monitor, click the application in the list of processes and then click the “Sample Process” button. Then makes sure the “Display:” popup is set to “Sample Text”."



Sampling process 3407 for 3 seconds with 1 millisecond of run time between samples


Sampling completed, processing symbols...

Analysis of sampling QuickTime Player (pid 3407) every 1 millisecond

Process: QuickTime Player [3407]

Path: /Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player

Load Address: 0x10e72e000

Identifier: com.apple.QuickTimePlayerX

Version: 10.1 (501)

Build Info: QuickTimePlayerX-501000000000000~3

Code Type: X86-64 (Native)

Parent Process: launchd [180]

[...]


Now, to disable recent item listing for Quicktime, you would issue the following commands in Terminal:"


defaults write com.apple.QuickTimePlayerX NSRecentDocumentsLimit 0
defaults delete com.apple.QuickTimePlayerX.LSSharedFileList RecentDocuments
defaults write com.apple.QuickTimePlayerX.LSSharedFileList RecentDocuments -dict-add MaxAmount 0


Restart QuickTime and your recent items should be cleared and no longer cached

Aug 17, 2011 2:29 AM in response to hellomesss

I use the following script to activate or deactivate the recent file history:


#! /bin/sh

#

# fhistory.sh

#

# Written in 2011 by Marcel Egloff

#

# A basic tool to display, enable or disable the (global) recent file history for an individual Application

#

# Use it at your own risk and do with it what you want as long as you don't blame me!

#

PROGRAM=`basename $0`

USAGE=`printf "%%i-$PROGRAM: usage: %s [-sd] Application\n" $PROGRAM`



enable=0

disable=0

while getopts ed opt; do

case $opt in

s) enable=1;;

d) disable=1;;

?) echo $USAGE

exit 1;;

esac

done



shift `expr $OPTIND - 1`



if [ $# -eq 1 ]; then

application=$1

else

echo $USAGE

exit 1

fi



extension=`echo $application | awk -F. '{ print $NF }'`

if [ "$extension" != "app" ]; then

application="$application.app"

fi



dir=`dirname $application`

if [ "$dir" != "." ]; then

path=$application

else

path=`find ~/Applications/* -name "$application"`

if [ -z "$path" ]; then

path=`find /Applications/* -prune -name "$application"`

fi

fi



if [ -n "$path" ]; then

if [ -f "$path/Contents/Info.plist" ]; then

if [ -x /usr/libexec/PlistBuddy ]; then

identifier=`/usr/libexec/PlistBuddy -c "print CFBundleIdentifier" "$path/Contents/Info.plist"`

else

printf "%%i-$PROGRAM: PlistBuddy not found in /usr/libexec - aborting\n"

exit 1

fi

else

printf "%%i-$PROGRAM: Info.plist not found in '$path/Contents' - aborting\n"

exit 1

fi

else

printf "%%i-$PROGRAM: Application '$application' not found\n"

exit 1

fi



if [ -n "$identifier" ]; then

echo "Path: $path"

echo "Identifier: $identifier"

if [ $enable -eq 0 -a $disable -eq 0 ]; then

echo

max=`defaults read $identifier.LSSharedFileList RecentDocuments 2> /dev/null | grep 'MaxAmount' | sed 's:[^0-9]*::g'`

if [ -z "$max" ]; then

echo "No history found - system defaults will be applied."

else

echo "Maximum number of files in history: $max"

echo

n=1

defaults read $identifier.LSSharedFileList RecentDocuments 2> /dev/null | grep 'Name[ ]*=' | awk -F'"' '{ print $2 }' | while read file; do

printf "%2d. %s\n" $n "$file"

n=$[n+1]

done

fi

elif [ $enable -eq 0 ]; then

defaults write $identifier NSRecentDocumentsLimit 0

defaults delete $identifier.LSSharedFileList RecentDocuments

defaults write $identifier.LSSharedFileList RecentDocuments -dict-add MaxAmount 0

printf "%%i-$PROGRAM: file history disabled\n"

else

defaults delete $identifier NSRecentDocumentsLimit 0

defaults write $identifier.LSSharedFileList RecentDocuments -dict-add MaxAmount 10 # should supply the system wide default here

printf "%%i-$PROGRAM: file history enabled\n"

fi

else

printf "%%i-$PROGRAM: Application identifier not found\n"

fi



Have fun!

Aug 17, 2011 1:42 PM in response to Shunyam

I've been struggling with this same issue and very nearly just gave up on Lion.


Rich's advice and Shunyam's program look very promising but I haven't been able to figure out how to use the program, and when I try to follow Rich's advice here is where I end up:



$ defaults write com.macromates.textmate.LSSharedFileList

Command line interface to a user's defaults.

Syntax:



'defaults' [-currentHost | -host <hostname>] followed by one of the following:



read shows all defaults

read <domain> shows defaults for given domain

read <domain> <key> shows defaults for given domain, key



read-type <domain> <key> shows the type for the given domain, key



write <domain> <domain_rep> writes domain (overwrites existing)

write <domain> <key> <value> writes key for domain



rename <domain> <old_key> <new_key> renames old_key to new_key



delete <domain> deletes domain

delete <domain> <key> deletes key in domain



domains lists all domains

find <word> lists all entries containing word

help print this help



<domain> is ( <domain_name> | -app <application_name> | -globalDomain )

or a path to a file omitting the '.plist' extension



<value> is one of:

<value_rep>

-string <string_value>

-data <hex_digits>

-int[eger] <integer_value>

-float <floating-point_value>

-bool[ean] (true | false | yes | no)

-date <date_rep>

-array <value1> <value2> ...

-array-add <value1> <value2> ...

-dict <key1> <value1> <key2> <value2> ...

-dict-add <key1> <value1> ...



I am especially interested in any possible global fix...

Aug 17, 2011 1:51 PM in response to jasonfromcorvallis

One more update... I thought the problem was a line break error on my end, but even with that fixed I still get


comp:~ user$ defaults write com.apple.QuickTimePlayerX NSRecentDocumentsLimit 0

comp:~ user$ defaults delete com.apple.QuickTimePlayerX.LSSharedFileList RecentDocuments

comp:~ user$ defaults write com.apple.QuickTimePlayerX.LSSharedFileList

Command line interface to a user's defaults.

Syntax:


'defaults' [-currentHost | -host <hostname>] followed by one of the following:


read shows all defaults

read <domain> shows defaults for given domain

read <domain> <key> shows defaults for given domain, key


read-type <domain> <key> shows the type for the given domain, key


write <domain> <domain_rep> writes domain (overwrites existing)

write <domain> <key> <value> writes key for domain


rename <domain> <old_key> <new_key> renames old_key to new_key


delete <domain> deletes domain

delete <domain> <key> deletes key in domain


domains lists all domains

find <word> lists all entries containing word

help print this help


<domain> is ( <domain_name> | -app <application_name> | -globalDomain )

or a path to a file omitting the '.plist' extension


<value> is one of:

<value_rep>

-string <string_value>

-data <hex_digits>

-int[eger] <integer_value>

-float <floating-point_value>

-bool[ean] (true | false | yes | no)

-date <date_rep>

-array <value1> <value2> ...

-array-add <value1> <value2> ...

-dict <key1> <value1> <key2> <value2> ...

-dict-add <key1> <value1> ...

comp:~ user$ RecentDocuments -dict-add MaxAmount 0

-bash: RecentDocuments: command not found

comp:~ user$

Aug 19, 2011 2:49 AM in response to Rich Fenton

Brilliant.


Rich! thank you.

The disable of Quicktimes recently opened items is amazing!


However, what would the terminal commands be to disable the recently opened docs in preview.app during mission controll?

Figured it out!


To disable the recently opened docs in Preview.app while invoking mission control (awful name ugh.) exposé!


In Terminal.app


defaults write com.apple.Preview NSRecentDocumentsLimit 0

defaults delete com.apple.Preview.LSSharedFileList RecentDocuments

defaults write com.apple.Preview.LSSharedFileList RecentDocuments -dict-add MaxAmount 0





Also, I dont have any experience with Scripting, how would one use the Scripts put on here? just curious.

A Terminal disable is perfect for me since I hate the feature (and Lion in general)


Message was edited by: James Kachan

Aug 19, 2011 3:50 AM in response to James Kachan

Hi James


A very 'high end user' approach to use the script could be:


1. in the shell, create a text file and open TextEdit:


$ touch fhistory.txt

$ open fhstory.txt


2. paste the script from above into this file and then save and close (make sure you start with the '#! /bin/sh line' and end with the 'fi' on the last line)


3. back in the shell rename the file and make it executable:


$ mv fhistory.txt fhistory.sh

$ chmod +x fhistory.sh


4. use the script with these variations:


Display the history:


$ fhistory.sh TextEdit


Delete and disable the history:


$ fhistory.sh -d TextEdit


Enable the history:


$ fhistory.sh -e TextEdit


Hope this helps :-)


The script previously posted has a small typo!!! Use this one here:


#! /bin/sh

#

# fhistory.sh

#

# Written in 2011 by Marcel Egloff

#

# A basic tool to display, enable or disable the (global) recent file history for an individual Application

#

# Use it at your own risk and do with it what you want as long as you don't blame me!

#

PROGRAM=`basename $0`

USAGE=`printf "%%i-$PROGRAM: usage: %s [-ed] Application\n" $PROGRAM`



enable=0

disable=0

while getopts ed opt; do

case $opt in

e) enable=1;;

d) disable=1;;

?) echo $USAGE

exit 1;;

esac

done



shift `expr $OPTIND - 1`



if [ $# -eq 1 ]; then

application=$1

else

echo $USAGE

exit 1

fi



extension=`echo $application | awk -F. '{ print $NF }'`

if [ "$extension" != "app" ]; then

application="$application.app"

fi



dir=`dirname $application`

if [ "$dir" != "." ]; then

path=$application

else

path=`find ~/Applications/* -name "$application"`

if [ -z "$path" ]; then

path=`find /Applications/* -prune -name "$application"`

fi

fi



if [ -n "$path" ]; then

if [ -f "$path/Contents/Info.plist" ]; then

if [ -x /usr/libexec/PlistBuddy ]; then

identifier=`/usr/libexec/PlistBuddy -c "print CFBundleIdentifier" "$path/Contents/Info.plist"`

else

printf "%%i-$PROGRAM: PlistBuddy not found in /usr/libexec - aborting\n"

exit 1

fi

else

printf "%%i-$PROGRAM: Info.plist not found in '$path/Contents' - aborting\n"

exit 1

fi

else

printf "%%i-$PROGRAM: Application '$application' not found\n"

exit 1

fi



if [ -n "$identifier" ]; then

echo "Path: $path"

echo "Identifier: $identifier"

if [ $enable -eq 0 -a $disable -eq 0 ]; then

echo

max=`defaults read $identifier.LSSharedFileList RecentDocuments 2> /dev/null | grep 'MaxAmount' | sed 's:[^0-9]*::g'`

if [ -z "$max" ]; then

echo "No history found - system defaults will be applied."

else

echo "Maximum number of files in history: $max"

echo

n=1

defaults read $identifier.LSSharedFileList RecentDocuments 2> /dev/null | grep 'Name[ ]*=' | awk -F'"' '{ print $2 }' | while read file; do

printf "%2d. %s\n" $n "$file"

n=$[n+1]

done

fi

elif [ $enable -eq 0 ]; then

defaults write $identifier NSRecentDocumentsLimit 0

defaults delete $identifier.LSSharedFileList RecentDocuments

defaults write $identifier.LSSharedFileList RecentDocuments -dict-add MaxAmount 0

printf "%%i-$PROGRAM: file history disabled\n"

else

read line

defaults delete $identifier NSRecentDocumentsLimit

read line

defaults write $identifier.LSSharedFileList RecentDocuments -dict-add MaxAmount 10 # should supply the system wide default here

printf "%%i-$PROGRAM: file history enabled\n"

fi

else

printf "%%i-$PROGRAM: Application identifier not found\n"

fi

Aug 24, 2011 1:24 PM in response to James Kachan

Just noticed your last question - essentially the script Shunyam included above is a Shell Script (nice script btw)

The best way run this would be to follow the instructions that he placed at the top; you can open a shell by selecting Applications > Utilities > Terminal


The screen that pop's up is your 'shell' - then follow the commands that are above


If you want a more graphical interface for automation then check out the Automator app in Applications - that is a very powerful tool - there is a Run Shell Script action in there but you'd need to still save the script above to a text file somewhere


Cheers

Rich

Sep 29, 2011 4:04 PM in response to hellomesss

I'm a little late to the party, but I found something that works without fancy scripts.

Either Apple patched it or this works just as well.


Click "Quicktime" in the menu bar at the top and then hold Shift to show the menu option "Quit and discard windows"


I cleared the recent items menu before I did this so you might have to do that too. Either way. Problem solved!

Clear recent items in Lion

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.