You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac执行source .bashrc报too many files open错误求助

执行source .bashrc时触发"too many files open"错误求助

每次执行source .bashrc都会遇到too many files open错误,当前我的.bashrc文件内容如下:

export PATH="/usr/local/opt/python/libexec/bin:$PATH"

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# Auto-complete command from history
export INPUTRC=~/.inputrc
. "$HOME/.cargo/env"

出现的错误信息:

/Users/[user]/.bashrc:.:5: too many open files: /Users/[user]/.bashrc
/Users/[user]/.bashrc:.:11: too many open files: /Users/[user]/.cargo/env

试过多篇指南里的方法都无效,想请教有没有人遇到过并解决该问题?

已尝试的操作:

  • 使用launchctl limit maxfiles查看文件打开限制,结果为:maxfiles 256 unlimited
  • 通过lsof -n | awk '{print $1, $2}' | uniq -c | sort -rn | head -n $LINES查看当前进程的文件打开数,结果如下:
689 Arc 2156
292 UserEvent 681
273 corespotl 757
184 Electron 866
174 CoreSpotl 1636
170 Spotlight 895
136 AppleSpel 989
118 Notificat 763
117 bird 747
99 suggestd 789
97 Terminal 862
97 Code\x20H 1214
90 loginwind 181
90 Code\x20H 1235
85 Finder 873
80 accountsd 686
76 java 1374
76 java 1360
75 Arc\x20He 2171
73 TextEdit 2307
69 ControlCe 782
67 identitys 711
66 com.apple 2310
63 Maccy 1095
  • 尝试用sudo launchctl limit maxfiles 1024 4096修改文件打开限制,但导致系统崩溃重启,问题未解决。

内容的提问来源于stack exchange,提问作者ozzywap

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 21:45:24