简体   繁体   中英

How can I get rid of “-bash: ulimit: open files” when I open terminal on my mac

Every time I open a new terminal, these messages show up:

-bash: ulimit: open files: cannot modify limit: Invalid argument
-bash: ulimit: max user processes: cannot modify limit: Operation not permitted

I do modify ulimit before, but I've forgotten what I've done. So How can I fix this, please help. THX

---- update ----

I don't hava a .profile or .bashrc in my home dir. But I have a ~/.bash_profile and /etc/bashrc. And ~/.bash_profile looks like

export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GF'
alias ll='ls -GFl'

export JAVA_HOME=$(/usr/libexec/java_home)
export LC_CTYPE="en_US.UTF-8"

/etc/bashrc looks like:

# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
   return
fi

PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
    update_terminal_cwd() {
        # Identify the directory using a "file:" scheme URL,
        # including the host name to disambiguate local vs.
        # remote connections. Percent-escape spaces.
    local SEARCH=' '
    local REPLACE='%20'
    local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
    printf '\e]7;%s\a' "$PWD_URL"
    }
    PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"
fi

I don't see anything abount ulimit.

---- update ----

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

Finally I solved this problem. I've found that there are 3 profile files which OS X will load when opening a new Terminal, they are "/etc/bashrc", "/etc/profile", "~/.bash_profile". I found 2 lines about ulimit configiuring at the bottom of "/etc/profile". I delete these 2 lines and solve this problem.

Anyway, thanks to @Jonathan Leffler, you remind me to find what other profile causing this problem. THX XD

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM