I have a strange issue on my new MacBook Pro (late-2016, touch bar).
It works fine and then, after using it for a while, opening new Terminal windows doesn't work because login hangs. Rebooting fixes the problem.
This seems to be an issue some other people have had so I tried all of their solutions already (from 1 and [2]):
- Removing
~/Library/Preferences/com.apple.Terminal.plist - Setting my default shell to another shell (from
/bin/zshto/bin/shor/bin/bash) - Removing or cleaning my
.profile,.zprofile, ... This does not work and I can validate that the issue occurs before the shell is even invoked, because if Iecho HEYas the first line of my.zshenvthis is not even reached. It must belogincausing the troubles. Editing/etc/profileto add an echo at the top also shows up nothing - Changing the
Run command:setting in my Terminal config to something likeecho fooalso does not work (leavingRun inside shellchecked or unchecked doesn't change anything).
Other notes:
- Like [2],
ssh-add -Kdoes not persist keys between reboots, something I never had troubles with before. - The console does not show any suspicious errors or warnings.
- Opening a new
Terminalwindow does seem to create tty file (/dev/ttys<number>). - When this occurs, it does not matter if I use Terminal.app or iTerm.app
- I have a pretty clean install (just got my laptop, didn't restore any backups, just installed some apps with
brew installandbrew cask install).
This is really hard to debug because I cannot reproduce it and often I can't open a new terminal to even try to find out what's going on.
Does anyone have any tips?
Update:
Using iTerm, I was able to get a shell by setting the start command to /bin/bash. In this shell, however, sudo does not work. It hangs (without showing the prompt) and ctrl-C and ctrl-D do no work when it hangs.
Using some other programs also does not work in this shell: node or /usr/local/bin/node both hang. As far as I can tell, it's programs that are in/usr/local/bin.
Update 2:
brew list --full-name results in these packages:
autoconf
automake
blueutil
boost
cabal-install
cairo
cfssl
cmake
coreutils
doxygen
editorconfig
erlang
ffind
ffmpeg
flow
fontconfig
fontforge
freetype
gdbm
gettext
ghc
git
glib
go
gobject-introspection
graphicsmagick
harfbuzz
haskell-stack
highlight
icu4c
influxdb
jemalloc
jpeg
keybase
lame
libevent
libffi
libpng
libtermkey
libtiff
libtool
libuv
libvterm
libxml2
lua
mongodb
msgpack
nginx
node
openssl
openssl@1.1
pango
pcre
pixman
pkg-config
postgresql
protobuf
python
python3
rabbitmq
readline
reattach-to-user-namespace
redis
sqlite
the_silver_searcher
thefuck
tmux
unibilium
unixodbc
wxmac
x264
xvid
xz
yarn
z
zsh
josegonzalez/php/php54
neovim/neovim/neovim
Update 3:
These points are in correspondence with @Monomeeth's answer:
When it happens, a
loginitem does show up in activity monitor. (Force) Quitting it also closes the Terminal window that was hanging. Closing the window manually does not make theloginprocess go away in the Activity Monitor.The terminal title is
Terminal — login — term big — ttys001 — 89x18 — ⌘1, whereterm bigis the settings name.There's no
sudoprocess showing up in the Activity Monitor. I can create asudoprocess by opening iTerm.app (which uses bash) and runningsudo echo okthere. It can not be Quit, but Force Quit works and kills it:bash-3.2$ sudo echo ok Killed: 9
Update 4:
When it happens, running login from a shell that's still available does work, while the login in newer shells seems to hang.
Update 5:
I recently got a new laptop (MacBook Pro 2017, no Touch Bar) and the problem persists.
I've switched shells as well: I'm now using fish with a pretty vanilla config. I think that rules out the shell as the culprit.
The OS has also been updated to 10.13.3 (17D47) High Sierra.
I've tried to install as little as possible on this machine:
brew list —-full-names
coreutils 8.29
dnsmasq 2.78
faac 1.29.9.2
fdk-aac 0.1.5
ffmpeg 3.4.1
fish 2.7.1
freetype 2.9
gdbm 1.14.1_1
gettext 0.19.8.1
git 2.16.1
highlight 3.42
htop 2.0.2_2
icu4c 60.2
imagemagick 7.0.7-22
jemalloc 5.0.1
jpeg 9b
lame 3.100
libav 12.2
libogg 1.3.3
libpng 1.6.34
libtermkey 0.20
libtiff 4.0.9_1
libtool 2.4.6_1
libuv 1.19.1
libvorbis 1.3.5_1
libvpx 1.7.0
libvterm 681
libyaml 0.1.7
lua 5.3.4_2
luajit 2.0.5
mongodb 3.6.2
msgpack 2.1.5
neovim 0.2.2
node 9.5.0
openssl 1.0.2n
opus 1.2.1
parallel 20180122
pcre 8.41
pcre2 10.30
postgresql 10.2
python 2.7.14_3
python3 3.6.4_2
readline 7.0.3_1
ripgrep 0.7.1
ruby 2.5.0
sqlite 3.22.0
the_silver_searcher 2.1.0
thefuck 3.25_1
unibilium 1.2.1
x264 r2795
xvid 1.3.5
xz 5.2.3
youtube-dl 2018.02.08
Not sure what this can be now. The only apps which I can think of are Divvy or Apptivate since they both seem outdated. This is the intersection of what was installed on the old vs the new machine:
coreutils
ffmpeg
freetype
gdbm
gettext
git
highlight
icu4c
jemalloc
jpeg
lame
libpng
libtermkey
libtiff
libtool
libuv
libvterm
lua
mongodb
msgpack
node
openssl
pcre
postgresql
python
python3
readline
sqlite
the_silver_searcher
thefuck
unibilium
x264
xvid
xz
Update 6:
Update 7:
My env typically looks like this:
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.k60Nf5UBfq/Render
DISPLAY=/private/tmp/com.apple.launchd.6FMoWPSlJI/org.macosforge.xquartz:0
EDITOR=env VIRTUAL_ENV= nvim -u /Users/john-doe/.config/vim/vimrc -p
GNUTERM=X11
HOME=/Users/romeo
HOMEBREW_NO_EMOJI=1
HOMEBREW_PREFIX=/usr/local
LANG=en_GB.UTF-8
LESS=-RI
LESSHISTFILE=-
LOGNAME=romeo
LS_COLORS=di=00;31:ex=00;37:mi=00;41;30:tw=00;33
MANPATH=/usr/local/opt/coreutils/libexec/gnuman
PAGER=less
PATH=/Users/john-doe/.config/fisherman/re-search:/usr/local/opt/python/libexec/bin:/usr/local/opt/ruby/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/MacGPG2/bin
PWD=/Users/romeo
SECURITYSESSIONID=186a8
SHELL=/usr/local/bin/fish
SHLVL=1
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.fQn5sHMuZP/Listeners
TERM=xterm-256color
TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=400
TERM_SESSION_ID=D2AF7A50-8B41-4793-9201-8304A02C9B29
TMPDIR=/var/folders/15/zcyyfw_x7638z7vfg5zd85z40000gn/T/
USER=romeo
XDG_CACHE_HOME=/Users/john-doe/.cache
XDG_CONFIG_HOME=/Users/john-doe/.config
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0









fishwith a pretty vanilla config) so I really can't tell what it is. – romeovs Feb 14 '18 at 11:49ps -efwould print a bunch of processes, but only ones without a terminal assigned;cd /dev; echo tty*worked, butls -l tty*would hang...ls -l ttys?worked,ls -l ttys???would hang. – lindes Feb 07 '20 at 17:37sudoprocesses amongst the list of non-terminal-associated (??inpsoutput) processes, andnodewas being used. I mention this because I see bothnodeandsudoin the question. Not sure if this is something relevant, or just coincidence, but thought I'd mention it. – lindes Feb 07 '20 at 17:38ps -fp $$from an otherwise-working shell was also non-responsive. I didn't try a custom-formatpsrun, but trying one which excludes thettyfield might be an interesting thing to try. Oh, and reboot did fix (at least temporarily) the problem on the machine where I saw this. :-/ – lindes Feb 07 '20 at 17:44