Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Remove foreign language files to save disk space Install
[Editor's note: I have replaced the original method listed here with a much safer version. The "find" command line hack removes some Epson and Apple files that also end in ".lproj".]

If you plan on using your machine for only English (or only one of the other languages), you can safely remove the foreign language files (*.lproj) from your drive, freeing up over 200mb of space. "Since EBCDIC" posted a script in this MacFixit forum thread that does the trick.

Read the rest of the article for the how-to!

You need to create a very simple "shell script". Open a terminal, make sure you're in your home directory ('cd" then return), and use your favorite editor to create the following file. Pico is the easiest edit to use, so if you're new to the terminal, try typing "pico nolproj" and then copying and pasting the following:
#!/bin/tcsh

sync
df
date
foreach language ( French Dutch Spanish Italian Swedish Portuguese German )
find / -name $language.lproj -type d -exec rm -r -- {} ; -prune
end
date
df
sync
Save the file, quit the editor, then type:
chmod +x nolproj
This makes the file executable. You can now run it by typing
sudo ~/nolproj
and entering your password.

The above script keeps all English files; if you want to keep a few, or a different one, just edit the language list and REMOVE those languages you want to KEEP. Anything in the list is DELETED.

Caution! Make sure you type the file exactly as shown! A simple little typo could delete all the files on your hard drive! Read the MacFixIt forum for a real-world example of how this could happen to you!
    •    
  • Currently 2.50 / 5
  You rated: 2 / 5 (4 votes cast)
 
[28,008 views]  

Remove foreign language files to save disk space | 13 comments | Create New Account
Click here to return to the 'Remove foreign language files to save disk space' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
remove script errors
Authored by: brachiator on Mar 27, '01 02:32:34AM

I tried to run this to remove the non-English parts, but got this errror:

find: -exec: no terminating ";"

Any ideas?



[ Reply to This | # ]
remove script errors
Authored by: Anonymous on Mar 27, '01 05:57:01AM

put a back slash before ';'. This should do the job.

[Hmm... looks like the board doesn't like a back slash being printed...]



[ Reply to This | # ]
backslashes...
Authored by: robg on Mar 27, '01 08:06:44AM

OK, I got the tip to read correctly. Turns out geeklog really doesn't like using the HTML character set inside of a <pre> tag. It kept turning my "&#092;" into a "" instead of a backslash. Switched that section to plaintext, and it's working. The tag as listed can now be copied and pasted (that was a bit of a pain!).



[ Reply to This | # ]
"..bunch of warnings..."
Authored by: Anonymous on Apr 05, '01 05:46:11PM
Original Message: It throws a bunch of warnings, but this is because the find command will find a nonenglish lproj, remove it, and then try to recurse down into it.
You're missing a -prune option in your find command which tells find to not traverse down into the directory you just removed. Here's an example of what the command should look like
  find / ! -name English.lproj -name "*.lproj" -type d -exec rm -r -- {} ; -prune

Lo




[ Reply to This | # ]
That's too broad!!
Authored by: bgg on Apr 21, '01 05:46:52AM
I tried this and there are some .lproj files which are needed for the system which aren't called "English.lproj". Removing them means reinstalling the system (which I've just done ...). Here's a much faster script (using sh this time) which is more selective, it just removes the listed set of language files:
df /
date
for L in French Dutch Spanish Italian Swedish Portuguese German; do
    if [ "$NAMES" ]; then
        NAMES="$NAMES -or"
    fi
    NAMES="$NAMES -name $L.lproj"
done
find / ( $NAMES ) -type d -print -exec rm -rf -- {} ; -prune
df / 
date 
This gave me back a very welcome ~100Mb on my far-too-small partition.

[ Reply to This | # ]
How to backup the files first
Authored by: Super-K on Apr 06, '01 11:07:56PM
I didn't feel good about just wasting the files so I made a backup of them all before removing.
find / ! -name 'English.lproj' -name '*.lproj' -type d -exec echo {} ; > nelprojlist.txt
I couldn't get -print to work with find, so I used the echo trick... That should give you a file "nelprojlist.txt" that has all the non-english lproj directories. Now we want to tar them all up:
gnutar -c -v -z -f nonenglish_lproj.tgz -T nelprojlist.txt
The resulting file is about 80MB. You might notice the @LongLink files showing up in your archive. Those are to hold filenames that are longer than 100 characters which were tar's limit back in the old days. :)

[ Reply to This | # ]
hmmm... or
Authored by: Super-K on Apr 06, '01 11:15:52PM

Of course you could just copy the files back from your MacOS X CD if you need them again... :)



[ Reply to This | # ]
doesn't work for me
Authored by: wealthychef on Mar 19, '02 09:12:59PM

[richcookmac:~] rcook% cat languageKiller.sh
#!/bin/tcsh
sync;df;date
foreach language ( French Dutch Spanish Italian Swedish Portuguese German )
find / -name $language.lproj -type d -exec rm -r -- {} ; -prune
end
date;df;sync

[richcookmac:~] rcook% sudo languageKiller.sh
(df and date outputs deleted)
find: missing argument to `-exec'
-prune: Command not found.
find: missing argument to `-exec'
-prune: Command not found.
find: missing argument to `-exec'
-prune: Command not found.
find: missing argument to `-exec'
-prune: Command not found.
find: missing argument to `-exec'
-prune: Command not found.
find: missing argument to `-exec'
-prune: Command not found.
find: missing argument to `-exec'
-prune: Command not found.
(df and date outputs trimmed)
[richcookmac:~] rcook%



[ Reply to This | # ]
Delocalizer
Authored by: mayhemstudios on Mar 20, '02 01:34:16AM

I used Delocalizer to get rid of all the non-english languages and I saved 204 megs of space :)

Cal :)



[ Reply to This | # ]
Delocalizer
Authored by: 128K Mac on Mar 20, '02 02:59:54AM

Steve Bombich wrote Delocalizer. That should say something.

Worked for me too.



[ Reply to This | # ]
missing backslash
Authored by: wealthychef on Mar 25, '02 11:27:28PM

There is an issue on this site about backslashes getting deleted. The above commands will not work. Specifically, in the line:
find / -name $language.lproj -type d -exec rm -r -- {} ; -prune
there needs to be a backslash before the semicolon, or else it needs to be quoted, e.g.:

find / -name $language.lproj -type d -exec rm -r -- {} ";" -prune
otherwise, the shell thinks the command ends after {}.



[ Reply to This | # ]
Remove foreign language files to save disk space
Authored by: weiland on Apr 16, '02 03:49:46PM

Dear Editor,

I am brand new to Mac OS X (ver. 10.1.3) but very interested in saving all that wasted language space (200MB). Been with the Mac since '85 or so. My expertise level is minute.

After reading the posts about the "Remove foreign language files to save disk space" I am confused and hope that you may shed some light on this subject for me?!
I hope to remove all except the English and German language files. The shell script featured below leaves me wondering how to do this thing correct without blowing things up? I will place some ****questions**** at the lines that confuse me. I have "Terminal" and see the Shell menu choices. I'll also want to say that I have no idea what all the below MEANS!

[Editor's note: I have replaced the original method listed here with a much safer version. The "find" command line hack removes some Epson and Apple files that also end in ".lproj".]

If you plan on using your machine for only English (or only one of the other languages), you can safely remove the foreign language files (*.lproj) from your drive, freeing up over 200mb of space. "Since EBCDIC" posted a script in this MacFixit forum thread that does the trick.

Read the rest of the article for the how-to!
You need to create a very simple "shell script".
Open a terminal, make sure you're in your home directory
('cd" then return), ***I have done that in Terminal and noticed the change in the window**** and use your favorite editor ****here is the first confusion! Should I use another application or stay in "Terminal" to type the Pico nolproj???**** to create the following file.
Pico is the easiest edit to use, so if you're new to the terminal, try typing "pico nolproj" and then copying and pasting the following:

#!/bin/tcsh


sync
df
date
foreach language ( French Dutch Spanish Italian Swedish Portuguese )
find / -name $language.lproj -type d -exec rm -r -- {} ; -prune
end
date
df
sync
Save the file,
**** Save the file to where??? In what folder, or just the desktop???**** quit the editor, then type:
**** then type where in what application? since we quit Terminal or the editor???****

chmod +x nolproj
This makes the file executable. You can now run it by typing
**** type where to run it???****

sudo ~/nolproj
and entering your password.
****I imaging that the "chmod entry will result in a space where to type the password???****

The above script keeps all English files; if you want to keep a few, or a different one, just edit the language list and REMOVE those languages you want to KEEP. Anything in the list is DELETED.

Caution! Make sure you type the file exactly as shown! A simple little typo could delete all the files on your hard drive! Read the MacFixIt forum for a real-world example of how this could happen to you!

I take the warning about typing things exactly as shown very seriously, but I need just a little more information! I further hope that you can respond in good spirit to provide me with the most accurate info to save all of this space on my HDisk.

Thank you in advance,

Mike Weiland



[ Reply to This | # ]
Remove foreign language files to save disk space
Authored by: salsa on Jun 25, '02 11:16:27PM

If you are like me, and prefer to avoid command lines, the terminal app. & anything that smacks of programming, there is a much simpler way to go about this. Just download the freeware "monolingual", available from Version Tracker. It is very simple to use, & you can choose specifically which languages to delete.



[ Reply to This | # ]