Core Dumps in Mac OS X

本文介绍如何解决MacOS X系统中因应用程序崩溃产生的核心转储(core dump)文件导致磁盘空间不足的问题。提供了禁用核心转储、删除现有核心转储文件的方法,并解释了这些文件的作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

MAC磁盘不停的变大,以下是解决方案。可能会影响某些服务,具体原因不明。

http://krypted.com/mac-os-x/core-dumps-in-mac-os-x/

Every now and then, OS X has to drop some kids off at the pool. Usually it’s some developer that didn’t build a sanity check for every-single-possible-flippin’-thing-you-might-think-to-do-to-his/her-poor-flippin’-app-OMGYFI! And then, suddenly, out of nowhere, you get crap all over the system. Actually, as expected, Apple’s dumps are pretty well sequestered in the /cores directory. Each core file has a number appended behind it. For example, core.9901. When applications crash, they can save a lot of information about the state when they crashed into these files. For example, I have seen  cached passwords in there…

To disable core dumps, add the following line to /etc/sysctl.conf:

kern.coredump=0

After a restart core dumps will be disabled. You can also set the coredump setting to 0 to disable it live, using the sysctl command, but it will revert back to 1 at the next reboot:

sudo sysctl -w kern.coredump=0

Existing core files are removed using the following command:

sudo rm -f /cores/*

As core files actually serve a purpose, if an application or the system needs some good troubleshooting-foo, re-enable:

sudo sysctl -w kern.coredump=1


Disable core file dumps on Mac


https://blog.liplex.de/disable-core-file-dumps-on-mac/

Mac OS X is still based on UNIX. Therefore OS X uses a lot of UNIX features. One of them are core dumps which are basically file dumps of your working memory in the moment of an app crashing. It helps a developer to look into why an app crashed or for an app to retrieve the last working environment.

Recently I ran into a full hard drive and had to look into what takes up how much space. Turns out there where a lot of those core dumps. Over 145GB of them to be more exact!

They are located in your root folder at /cores. I just deleted all of them with:

$ rm -f cores/*

You can disable the dumping of those core files with the following command:

$ sudo sysctl -w kern.coredump=0

But this won't be persisted through a restart. To do so create a new file on /etc/sysctl.conf (if it does not exist yet) and write in the following configuration:

kern.coredump=0  



E:\AI_System\web_ui>python server.py Traceback (most recent call last): File "E:\AI_System\web_ui\server.py", line 19, in <module> from core.config import CoreConfig as SystemConfig File "E:\AI_System\core\__init__.py", line 4, in <module> from .environment import EnvironmentInterface, DefaultEnvironment, EnvironmentManager ImportError: cannot import name 'EnvironmentInterface' from 'core.environment' (E:\AI_System\core\environment.py) E:\AI_System\web_ui>python server.py 2025-08-12 03:38:45,565 - CoreConfig - INFO - 📋 初始化配置管理器 | 环境前缀: AI_SYSTEM_ | 基础目录: E:\AI_System 2025-08-12 03:38:45,565 - CoreConfig - INFO - 🔍 加载环境变量... 2025-08-12 03:38:45,565 - CoreConfig - INFO - 📄 加载配置文件: E:\AI_System\config\system_config.json (类型: json) 2025-08-12 03:38:45,565 - CoreConfig - INFO - - 加载配置项: model = gpt-3.5-turbo 2025-08-12 03:38:45,565 - CoreConfig - INFO - - 加载配置项: api_key = y***e 2025-08-12 03:38:45,565 - CoreConfig - INFO - - 加载配置项: log_level = INFO 2025-08-12 03:38:45,566 - CoreConfig - INFO - - 加载配置项: database = {字典, 键数: 3} 2025-08-12 03:38:45,566 - CoreConfig - INFO - - 加载配置项: services = {字典, 键数: 2} 2025-08-12 03:38:45,566 - CoreConfig - INFO - ✅ 配置加载完成 | 条目数: 11 2025-08-12 03:38:45,566 - CoreConfig - INFO - 🔄 配置变更检测: 新增 5 项, 删除 0 项, 修改 0 项 2025-08-12 03:38:45,566 - CoreConfig - INFO - ➕ 新增配置: model, api_key, log_level, database, services 2025-08-12 03:38:45,566 - CoreConfig - INFO - 📁 创建目录: E:\AI_System\cache 2025-08-12 03:38:45,568 - CoreConfig - INFO - 📋 初始化配置管理器 | 环境前缀: AI_SYSTEM_ | 基础目录: E:\AI_System 2025-08-12 03:38:45,568 - CoreConfig - INFO - 🔍 加载环境变量... 2025-08-12 03:38:45,568 - CoreConfig - INFO - 📄 加载配置文件: E:\AI_System\config\system_config.json (类型: json) 2025-08-12 03:38:45,568 - CoreConfig - INFO - - 加载配置项: model = gpt-3.5-turbo 2025-08-12 03:38:45,568 - CoreConfig - INFO - - 加载配置项: api_key = y***e 2025-08-12 03:38:45,568 - CoreConfig - INFO - - 加载配置项: log_level = INFO 2025-08-12 03:38:45,568 - CoreConfig - INFO - - 加载配置项: database = {字典, 键数: 3} 2025-08-12 03:38:45,569 - CoreConfig - INFO - - 加载配置项: services = {字典, 键数: 2} 2025-08-12 03:38:45,569 - CoreConfig - INFO - ✅ 配置加载完成 | 条目数: 14 2025-08-12 03:38:45,569 - CoreConfig - INFO - 🔄 配置变更检测: 新增 5 项, 删除 0 项, 修改 0 项 2025-08-12 03:38:45,569 - CoreConfig - INFO - ➕ 新增配置: model, api_key, log_level, database, services 2025-08-12 03:38:45,569 - CoreInit - INFO - Core module initialization started 2025-08-12 03:38:45,569 - EnvironmentManager - INFO - 环境管理器初始化完成 (基础目录: E:\AI_System\data\environment) 2025-08-12 03:38:45,569 - CoreInit - INFO - Environment manager created: DefaultEnvironment 2025-08-12 03:38:45,570 - CoreInit - INFO - Core module initialized successfully 2025-08-12 03:38:45,570 - CoreConfig - INFO - 📋 初始化配置管理器 | 环境前缀: APP_ | 基础目录: E:\AI_System 2025-08-12 03:38:45,570 - CoreConfig - INFO - 🔍 加载环境变量... 2025-08-12 03:38:45,570 - CoreConfig - INFO - ✅ 配置加载完成 | 条目数: 6 Traceback (most recent call last): File "E:\AI_System\web_ui\server.py", line 64, in <module> logger = setup_logger() File "E:\AI_System\web_ui\server.py", line 29, in setup_logger logger.setLevel(logging.DEBUG if system_config.DEBUG else logging.INFO) AttributeError: 'CoreConfig' object has no attribute 'DEBUG' E:\AI_System\web_ui>
08-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值