1

I'm on a Mac and whenever I start up my terminal app the initial startup prints the following:

Picked up _JAVA_OPTIONS: -XX:MaxPermSize=4G -Xmx4G
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=4G; support was removed in 8.0
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode)
Picked up _JAVA_OPTIONS: -XX:MaxPermSize=4G -Xmx4G
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=4G; support was removed in 8.0
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode)

It seems to be loading Java twice and I'm not sure why. I thought this was coming from my ~/.bash_profile file but I can't seem to find what is doing it. This is what is contained in my bash_profile:

export AD_USERNAME=myfirstname.mylastname
    yodle_dev_include_repo_prompt=1
    source $HOME/.dev-shell-utils/conf/sh/all
    export GRADLE_OPTS="-Dfile.encoding=UTF-8"
    if [ -f ~/.bashrc ]; then . ~/.bashrc; fi

    # Instead of modifying your local .bash_profile, consider updating dev-shell-utils instead.
    # TODO: Move the following into dev-shell-utils.

    removeFromPath ()
    {
        export PATH=$(echo $PATH | sed -E -e "s;:$1;;" -e "s;$1:?;;")
    }

    setHaProxyAlias ()
    {
        sudo ifconfig lo0 alias 172.17.32.1
    }

setjdk 1.8
    # Prefer Homebrew installed utils
    PATH=$PATH:$(brew --prefix coreutils)/libexec/gnubin
    MANPATH=$(brew --prefix coreutils)/libexec/gnuman:$MANPATH

    PATH=$PATH:/workspace/src/core/ThriftTools/Thrift/bin

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 -GFh'

Thought it might be my bashrc file but it seems like all that is doing is setting some aliases and environment variables.

alias readlink="greadlink"
alias jbossrun="sudo /usr/local/jboss/bin/run.sh -b 0.0.0.0 -DSERVICE_DISCOVERY=true"
export _JAVA_OPTIONS="-XX:MaxPermSize=4G -Xmx4G"
export JBOSS_HOME=/usr/local/jboss
export PATH=/usr/local/bin:$PATH

Any thoughts on what could be causing this double print-out when I start up my bash terminal? I'm using Hyper but this happens with the default Mac terminal app and iTerm as well.

Thanks for any help!

  • 3
    There is the source $HOME/.dev-shell-utils/conf/sh/all line, so what is in that file? If you run setjdk 1.8 as a command do you get these lines output? – icarus Aug 2 '19 at 15:36
  • Have you tried running . ~/.profile, ~/.bash_profile, . ~/.bashrc, and ./.bash_aliases? – ctrl-alt-delor Aug 2 '19 at 15:56
  • Your indenting is all over the place. It makes it hard to read. – ctrl-alt-delor Aug 2 '19 at 15:58
  • ~/.bashrc isn't read by interactive shells on macOS since they seem to always start login shells by default. – terdon Aug 2 '19 at 16:04
1

Nothing in the code that you show prints any of the output that you shows, so it must be coming from some part that you don't show.

You should be able to find the culprit by yourself, or at least to isolate a small, problematic part, with the following information:

  • On macOS, each terminal opens a login shell by default.
  • When bash is started as a login shell, it executes commands from ~/.bash_profile.
  • Put set -x at the top of .bash_profile and bash will print a trace of each command just before it executes it. It'll look like this:
    + export AD_USERNAME=myfirstname.mylastname
    + AD_USERNAME=myfirstname.mylastname
    + yodle_dev_include_repo_prompt=1
    + source /home/intA/.dev-shell-utils/conf/sh/all
    …
    
    So check which commands(s) print this unwanted output.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.