Process completed immediately after opening Terminal

Solution 1:

Go to Preferences → General and set Shells open with to Command, and enter the following:

/bin/bash -x

Open a new shell and see what is being run, then remove the relevant lines from your profile files.

Solution 2:

  1. Go to Terminal icon on Dock, press right click and press New Command 2./bin/bash -x (it shows your problem)
  2. sudo nano .bash_profile (open this problem place)
  3. delete this, Ctrl + X (exit) Yes, Enter

Solution 3:

I know this is old...but I had the same problem, and couldn't find any information to fix this issue, so I decided to share the solution here too.

Hopefully it helps someone else. :)

After upgrading a Mac from OS X 10.6.8 (Snow Leopard) to 10.11.4 (El Capitan), it would no longer open a shell in Terminal. It would open a Terminal Window with only [Process completed] displayed on the screen.

The Console log showed the errors:

login: in openpam_load_module(): no pam_serialnumber.so found
login: pam_start(): system error

This post (https://discussions.apple.com/message/11861278#11861278) pointed me in the right direction.

I checked the contents of /private/etc/pam.d/login.term on the affected Mac, and on a working Mac.

Broken Mac Terminal /private/etc/pam.d/login.term

# login: auth account password session
auth       optional       pam_krb5.so
auth       optional       pam_mount.so
auth       sufficient     pam_serialnumber.so serverinstall legacy
auth       required       pam_opendirectory.so
account    required       pam_nologin.so
account    required       pam_opendirectory.so
password   required       pam_deny.so
session    required       pam_uwtmp.so
session    optional       pam_mount.so

Working Mac Terminal /private/etc/pam.d/login.term

# login: account session
account    required       pam_nologin.so
account    required       pam_opendirectory.so
session    required       pam_uwtmp.so

I edited the contents of the Mac with the broken Terminal to match the Mac with the working Terminal, and Terminal immediately started working correctly. 😃