Macos 我怎样才能摆脱“我的”呢-bash:ulimit:openfiles";当我在mac上打开终端时

Macos 我怎样才能摆脱“我的”呢-bash:ulimit:openfiles";当我在mac上打开终端时,macos,bash,ulimit,Macos,Bash,Ulimit,每次打开新终端时,都会显示以下消息: -bash: ulimit: open files: cannot modify limit: Invalid argument -bash: ulimit: max user processes: cannot modify limit: Operation not permitted 我以前确实修改过ulimit,但我忘了我做过什么。那么我该如何解决这个问题,请帮忙。THX ----更新---- 我的主页目录中没有.profile或.bashrc。但是

每次打开新终端时,都会显示以下消息:

-bash: ulimit: open files: cannot modify limit: Invalid argument
-bash: ulimit: max user processes: cannot modify limit: Operation not permitted
我以前确实修改过ulimit,但我忘了我做过什么。那么我该如何解决这个问题,请帮忙。THX

----更新----

我的主页目录中没有.profile或.bashrc。但是我有一个~/.bash_档案和/etc/bashrc。和~/.bash_配置文件看起来像

export PS1=“\[\033[36m\]\u\[\033[m\]@[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$”
导出CLICOLOR=1
导出LSCOLORS=exfxbxdxxegedabagacad
别名ls='ls-GF'
别名ll='ls-GFl'
导出JAVA_HOME=$(/usr/libexec/JAVA_HOME)
出口信用证类型=“en_US.UTF-8”
/etc/bashrc看起来像:

交互式bash(1)shell的系统范围.bashrc文件。 如果[-z“$PS1”];则 返回 fi PS1='\h:\W\u\$' #让bash在进程完成后检查其窗口大小 shopt-s checkwinsize #在每次提示时告诉终端有关工作目录的信息。 如果[“$TERM_PROGRAM”==“Apple_Terminal”]&&&&[-z”$INSIDE_EMACS”];则 更新_终端_cwd(){ #使用“文件:”方案URL标识目录, #包括主机名以消除本地vs。 #远程连接。转义空间的百分比。 本地搜索=“” 本地替换=“%20” 本地PWD_URL=“文件://$HOSTNAME${PWD//$SEARCH/$REPLACE}” printf'\e]7;%s\a'$PWD\u URL“ } PROMPT\u COMMAND=“更新\u终端\u cwd;$PROMPT\u命令” fi 我看不到关于乌利米特的任何东西

----更新----


最后我解决了这个问题。我发现OS X在打开新终端时将加载3个配置文件,它们是“/etc/bashrc”、“/etc/profile”、“~/.bash\u profile”。我在“/etc/profile”的底部找到了关于ulimit配置的2行。我删除了这2行并解决了这个问题


无论如何,感谢@Jonathan Leffler,您提醒我找到导致此问题的其他配置文件。THX XD

查看您的配置文件:
~/.profile
~/.bash\u profile
~/.bashrc
,并找到您试图调用
ulimit
的位置。您可能需要在
/etc
下查找,但可能无法取消减少了你在下面修改配置文件等的次数。将
set-x
添加到
~/.bash\u profile
的顶部,并将
set+x
添加到底部。创建一个新的终端窗口。你应该可以看到由
~/.bash\u配置文件执行的命令的跟踪。错误消息产生的位置。如果是在前面还是后面跟踪代码之后(您可能希望在
set+x
之后回显类似
echo“trace off”
),那么您就知道,
~/.bash\u profile
并没有产生问题;它是另一个文件。您可能需要阅读手册才能找到它读取的其他文件。一次调试一个文件。@JonathanLeffler/etc/bashrc或~/.bash\u profile:(来自
ulimit-a-H
ulimit-a
的值是什么?将输出添加到问题中的信息中。@JonathanLeffler更新
sudo ulimit -a -H
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) unlimited
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 65532
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1064
virtual memory          (kbytes, -v) unlimited

sudo ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 4864
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 709
virtual memory          (kbytes, -v) unlimited