12

After I open Terminal in OS X:

Last login: Tue Oct 28 10:29:21 on ttys000 login(14773,0x7fff7572f300) malloc: * error for
object 0x7fd4bb715110: pointer being freed was not allocated * set a breakpoint in
malloc_error_break to debug

[Process completed]

I have no idea what I did or how to fix it.

  • I would bet something is wrong in your .profile or .bashrc causing this error and make he shell not able to start. – Matthieu Riegler Oct 28 '14 at 11:17
  • .bashrc <- what is that? I cant google it lol... Im new to mac ;] I dont even have /etc folder – user98034 Oct 28 '14 at 11:23
  • OS X doesn't source ~/.bashrc by itself anyway, so check ~/.profile and other such files to see if they source ~/.bashrc —cc @Matthieu – grg Oct 28 '14 at 11:37
  • and ~/.bash_profile – user151019 Aug 22 '15 at 11:02
8

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.

| improve this answer | |
  • still the same. In the preferences (general from dock) I cant turn on "general", "start disc" and "notice" ;] something is broken I guess. OSX yosmite – user98034 Oct 28 '14 at 11:34
  • I know. But I cant open those tabs in general preferences now, so there may be more things broken. – user98034 Oct 28 '14 at 11:38
  • @user Ah, I see what you mean. Yes, that would indicate something else is wrong—perhaps reinstall OS X? – grg Oct 28 '14 at 11:39
  • is there any simply way to do it? I have mac mini – user98034 Oct 28 '14 at 11:41
  • @user98034 Perhaps everyone is assuming knowledge you don't have. Files with names starting with a dot, like .profile and so on are generally invisible. You can list the names of the files in Terminal.app by typing "ls -a". You can see what is in a file like .profile by typing "cat .profile". You can then open another window (shell) in Terminal.app. You can type the commands in one by one, or you can copy-and-paste from one window to another. By looking in the new window, you can see the effect of each command individually. – David Epstein Oct 28 '14 at 21:35
4
  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
| improve this answer | |
  • 1
    Your answer doesn't seem to add anything beyond grgarside's answer. – John N Jan 19 '17 at 11:07
  • It does: I can't enter the command in the path grg proposes. And JustGo's answer gave me a way I could run shell commands to fix the issue. I couldn't even crack-open the dot-files in a text editor: Apple "helpfully" doesn't expose them in finder. So if your shell is terminating as quickly as you open it as is the case with this issue, this is a way in- – F1Linux Apr 23 '19 at 12:28
1

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. 😃

| improve this answer | |
0

This could be something as simple as some borked permissions. I was having some issues starting up a shell when I migrated a machine to Yosemite, and a permission repair took care of the problem.

Try to use the "Repair Permissions" function on your startup disk using Disk Utility.app. Hopefully, as it's running, the log window will show a series of files with incorrect permissions. If you have more than one or two files with bad permissions, rinse and repeat until you get a clean log.

Note: occasionally there will be some files that trip up the repair utility (can't recall specifics at the moment), but on a new Mac mini, you should be able to get a clean run on the second or third try.

| improve this answer | |
0

None of the other solution worked for me. It seems that my terminal was spitting out process completed because I was low on disk space. Deleting files didn't help. I had to delete my time machine local snapshots.

| improve this answer | |
-1

The following solved it for me:

  1. Go to: Terminal > Preferences
  2. Scroll down to: Shell
  3. Change, /bin/bash to: /bin/sh
| improve this answer | |
-1
  1. Go to Terminal icon on Dock, press right click and press New Command
  2. /bin/bash -x , and reopen Terminal (it shows your problem)
  3. Go to Preferences → General and set Shells open with to Command, and enter the following: /bin/sh
  4. Close the Terminal Preferences window
  5. Open Terminal again (it should work)
  6. vi /Users/<your_user>/.bash_profile, remove the lines found in step 2.
  7. Go to Preferences → General and set Shells open with to Command, and enter the following: /bin/bash
  8. Open Terminal, it should work now
| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .