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

Turn off core dumps for one or all users System
Mac OS X's UNIX core has a nice feature that works when a program crashes. It tries to keep a record of what was going on at the time the program gave up the ghost, but for a normal user, this isn't a particularly useful feature -- unless you're a programmer. With that said, it's usually best to disable it. To do so, add the following line to your home directory's .cshrc file. To prevent all users from saving coredumps, you can turn it off in the /etc/csh.cshrc file with these instructions:
  1. From the terminal, type cd /etc. You should be in the etc directory.
  2. Type sudo pico csh.cshrc and enter your password when prompted. This will open csh.cshrc, and allow you to edit the file.
  3. Scroll to the end of the file and add the following line: limit coredumpsize 0 That's the line you would add to your .cshrc if you're just changing the settings for one user.
  4. Hit Control-X, press Y, then Enter.
  5. Restart your computer, or type limit coredumpsize 0 in the Terminal to have it take affect immediately.
If you ever decide that you need coredumps turned on temporarily, you can type unlimit coredumpsize in the Terminal. This will turn coredumps on for the duration of the shell. Or delete the line you just added in the .cshrc file completely.

[robg adds: I haven't tested this one.]
    •    
  • Currently 3.40 / 5
  You rated: 5 / 5 (5 votes cast)
 
[9,730 views]  

Turn off core dumps for one or all users | 22 comments | Create New Account
Click here to return to the 'Turn off core dumps for one or all users' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Turn off core dumps for one or all users
Authored by: arpee on May 31, '03 02:15:36AM

What's the use ?



[ Reply to This | # ]
verbose unix features
Authored by: lagroue on May 31, '03 04:00:11AM

Save some space, I guess ?

Or, more generally, considering that unix core is silently filling many hidden folders, most of them being useful for pure unix users, purpose could be calming down your mac if you're "only" a pure mac user.

BTW, my ~/Library/Logs contains a dozen crash logs, and is only 192Ko. Quite light compared to my /var/log directory : 55Mo...

My mac is now always running and never sleeps, so it can run its crontabbed archiving scripts every day, week and month, automatically saving space on my hard disk. (crontabbed archiving scripts are unix programs that gently sweep your mac's hidden unix corners).

I wonder how this sweeping can be done automatically if the mac is not running when these scripts are supposed to run ?

Any idea, somebody ? (admitting it could be at least as useful as getting rid of crash logs)



[ Reply to This | # ]
Sweeping
Authored by: Spartacus on May 31, '03 05:06:55AM

I installed anacron from fink. It works like crontab, except that if a job was not run at the given schedule because the Mac was sleeping or turned off, it runs it later when the Mac is on. I'd like to compile it without fink but I didn't manage it yet.

http://anacron.sourceforge.net/
http://sourceforge.net/projects/anacron



[ Reply to This | # ]
Sweeping
Authored by: bhines on May 31, '03 06:09:54PM

You have some objection to having your software easily upgraded, managed and removed, that makes you want to install it yourself instead of via fink? :)



[ Reply to This | # ]
Sweeping
Authored by: astrox on Jun 01, '03 01:18:28PM

As nice as that is, Ben, there are still some reasons for not using Fink. I sometimes want to install an executable to /usr/local/ or just /usr. It makes compiling other software easier when you don't have to set up $PATH and such to find the Fink header files and libraries. Abiword actually has a configure switch specifically to address this, but not every OSS package out there is so comprehensive.

And then there is the fact that Fink leaves not only the older files (/usr) in your system, but also leaves the source archive as well as the .deb to waste disk space. (Assuming you compile from the unstable tree, that is.)

I think Gentoo is a pretty good model for package management as well, but that doesn't get talked about much around here :)



[ Reply to This | # ]
Running cleanup scripts
Authored by: AMacAddict on May 31, '03 09:39:48AM

Freeware available at VersionTracker, MacJanitor, runs the three daily/weekly/monthly cleanup scripts for you.



[ Reply to This | # ]
Running cleanup scripts
Authored by: qrulf on May 31, '03 10:38:52AM

... or you could just open the terminal and type in one or more of the following commands:

sudo periodic daily
sudo periodic weekly
sudo periodic monthly

For more info, type in: man periodic



[ Reply to This | # ]
are there only unix administrators here ?
Authored by: lagroue on May 31, '03 11:58:22AM

Sure...

MacJanitor is handy, except that it never reminds you to launch it. And when it's running, it can't even hide itself, so your desktop is ugly until the task is complete (and locate db is long to build). I dropped it long time ago...

And anybody who knows the Terminal also knows about cron etc.

Frankly, unix systems lead to weird side effects for those who don't have any unix skills : go in to sh or die. Or stand by OS9...



[ Reply to This | # ]
are there only unix administrators here ?
Authored by: Darkshadow on May 31, '03 12:30:01PM

No, go in to sh and learn to live with it; go into perl and die. ;)



[ Reply to This | # ]
are there only unix administrators here ?
Authored by: bostmass on May 31, '03 10:03:30PM

You should give Cronathon a try. You can download it at nonamescriptware.com. You can also use the freeware Cronnix to schedule when it will run so you don't have to remember. Hope that helps.



[ Reply to This | # ]
are there only unix administrators here ?
Authored by: sfn on May 31, '03 10:23:26PM
Try Macaroni.

---
-sfn

[ Reply to This | # ]

are there only unix administrators here ?
Authored by: rusto on Jun 01, '03 06:59:39AM
so your desktop is ugly until the task is complete
Too lazy to type command-H? :)

[ Reply to This | # ]
are there only unix administrators here ?
Authored by: lagroue on Jun 01, '03 07:53:29AM

MacJanitor is deaf. As deaf as a bad-mooded unix administrator.

"Do you want me to work, or to hide ? ... OK, so let me work now, I'll call you back."



[ Reply to This | # ]
are there only unix administrators here ?
Authored by: rusto on Jun 02, '03 11:40:44AM

Works fine for me while hidden. Good doggy.



[ Reply to This | # ]
are there only unix administrators here ?
Authored by: newbish on Jun 02, '03 11:12:48AM
"And anybody who knows the Terminal also knows about cron etc."


Actually, this is not true. A lot of the people on MacOSXHints are here to learn the UNIX-layer of Mac OS X. Certainly, I am one of them. Fortunately, there are also lots of propellar-heads who are on MacOSXHints to teach us and to share what they know. :)

That being said, cron is not the first thing most people hear about during the learning process. A lot of newbies stumble across cron early on and their reaction is, "WOW! I can make my computer do stuff at certain times without having to run another program? COOL!" But what to actually do with it is another mystery. Imagine how silly I felt thinking that the at command was another cron-like command, only to discover that an entry needed to be made in the crontab to make at work.

With all that being said, once you learn about cron and how it works, it is not difficult to edit the crontab to change the times when the janitorial routines actually run. I changed mine to the middle of the day, because that's when my computer is actually powered-on. Here's my actual crontab:

    #minute hour mday month wday who command
    #
    #*/5 * * * * root /usr/libexec/atrun
    #
    # Run daily/weekly/monthly jobs.
    15 12 * * * root periodic daily
    30 13 * * 5 root periodic weekly
    30 14 1 * * root periodic monthly


To change it, I used sudo pico /etc/crontab and changed the times. All the times in the crontab are written in 24hr format. As it reads above, my daily runs at 12:15 PM each day, the weekly runs at 1:30 PM every Friday (5), and the monthly will run at 2:30 PM on the first of the month. This maximizes the odds that periodic will run while my computer is on. The key weakness, though, is the monthly task, which may not run if the 1st falls on a weekend, and I didn't run my computer because I was out doing other things.

If I'm not sure the monthly ran, I can use:

    cat /var/log/system.log | grep "periodic monthly"

to see if it did. Of course, if the daily ran, then I will need to go to the archived log to do the same thing. If you aren't sure that a periodic ran, then you can use the periodic command to force the issue:

    sudo periodic [daily, weekly, or, monthly]
Good luck!

[ Reply to This | # ]
Nice hint...
Authored by: englabenny on Jun 02, '03 01:38:14PM
...to tell me to search and see if those jobs ever ran. I came out with a clever trick to search all of my logs, even the gzipped ones, with this line:

( cat /var/log/system.log ; gzip -dc /var/log/system.log.* ) | grep daily

And I found that the dailies and weeklies ran as proper scheduled, the daily had rum for example almost every third day..

The monthly job had however never run the last three months... I'll run it now.

[ Reply to This | # ]
are there only unix administrators here ?
Authored by: hamarkus on Jun 02, '03 01:55:41PM

Better than MacJanitor would be the simple perlscript found here ( http://theapotek.com/teknotes/archives/000012.html#000012 ) which checks every hour (or whatever you set it to) whether the scripts have been run or not, and if not runs them, completely automatically. Something similar with a GUI is Cronnix, already mentionned before: http://www.koch-schmidt.de/cronnix/



[ Reply to This | # ]
Turn off core dumps for one or all users
Authored by: bhines on May 31, '03 06:08:14PM

Uh, coredumps are OFF by default, so there is no need for 99.9% of users to turn them off. And, if they know how to turn them on (which they do, if they are on) then they probably know how to turn them off.

coredumps are not equal to crash logs.



[ Reply to This | # ]
Turn off core dumps for one or all users
Authored by: bostmass on May 31, '03 10:01:18PM

Where did you get the idea that they are turned off by default? I'm curious what that comment is based on. Thanks.



[ Reply to This | # ]
Turn off core dumps for one or all users
Authored by: platon on Jun 01, '03 10:01:14AM

Open Terminal and enter the command "limit"



[ Reply to This | # ]
Turn off core dumps for one or all users
Authored by: bostmass on Jun 01, '03 04:42:34PM

Thanks for the info. The hint is for unix admins who don't want coredumps turned on by users. Hope that helps.



[ Reply to This | # ]
Turn off core dumps for one or all users
Authored by: osxpounder on Jun 03, '03 04:45:33PM

Great to know. As someone else already posted, those who know the Terminal don't automatically know a thing about cron. I'm one; I am all over that Terminal, but the OSX is the first machine I've ever had access to as an admin, so I never had exposure to things that an ordinary user wouldn't see. I have learned to copy, move, rename and search files, for example, but never to cron.

It's great to know that coredumps are off by default. I'm glad someone not only pointed that out for us, but showed us how to prove it to ourselves using the "limit" commands. Excellent!

---
--
osxpounder



[ Reply to This | # ]