Terminal on Mac does not save preferences

I am using Mac High Sierra v10.13.1. I have been trying to save the preferences for terminal to something other than the default.

The strange thing is that whenever the terminal is closed (via command+Q) and after restarting, it will load back to the default profile. Even if I add a custom profile, the said profile will be gone. I am using Spotlight to launch the terminal (via command + space).

Am I doing something wrong or is this a bug?

4 Answers

@justingiffard was correct with the chown command.

Shortest answer is:

  1. Check the ownership of the terminal.plist by runningls -l ~/Library/Preferences/com.apple.Terminal.plist
  2. If the ownership is root or something other than your username then the ownership needs to change to you. The usergroup may also need to change if it's not already staff. Both can be done with one command:sudo chown <your username>:staff ~/Library/Preferences/com.apple.Terminal.plist
  3. You will be prompted to enter your password, and then you should be able to save your preferences once and for all! You can verify that step 2 worked by running the code in step 1 again to confirm that you are now listed as the owner
1

I found this discussion on Apple Discussion and much like a few other places they mention a fix that relates to ~/Library/Preferences/. What they suggested was to delete the plist file for the specific package and then logout and log back in again.

I investigated this by saying ls -l ~/Library/Preferences/com.apple.Terminal.plist which showed me the following permisions: -rw------- 1 root for the file... ah getting somewhere!

I used ls -l ~/Library/Preferences/ to see the permissions of the rest of the directory and most of the others were -rw------- 1 justin. Yup definitely onto something here.

I then moved that file to Desktop (sudo mv ~/Library/Preferences/com.apple.Terminal.plist ~/Desktop) instead of deleting it and then rebooted my machine and hey presto terminal was happy and saved my preferences and profile. Win!

I then once again checked permissions of files in ~/Library/Preferences/ and all of them except for com.apple.Safari.plist was owned by me. So I deleted that and deleted the Terminal plist from my desktop (sudo rm ~/Library/Preferences/com.apple.Safari.plist and sudo rm ~/Desktop/com.apple.Terminal.plist) and rebooted

Now I am not 100% sure whether or not one could have fixed this with chown, maybe someone can try? In my case it would be something like sudo chown justin:staff ~/Library/Preferences/com.apple.Terminal.plist or maybe evensudo chown -R justin:staff ~/Library/Preferences

But deleting the plists did the trick for me also as a side note they also mention in that answer deleting .lockfile. I didnt have any so skipped that step.

1

I had this, in that it would not remember my history across windows. My workaround is to add:

SHELL_SESSION_HISTORY=0

to the start of ~/.bash_profile

You might also want to check Terminal.app Preferences:

enter image description here

1

Terminal Shell -> Preferences -> Profile Screenshot of the terminal Profiles

Ensure before you close the screen you click the "Default" option so that this is saved for the future. This worked for me. Hope this helps.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like